home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-06-28 | 489.9 KB | 15,923 lines |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- TEGL Windows Toolkit II
- Release 1.10
- Programmer's Reference Guide
-
- Copyright (C) 1990, TEGL Systems Corporation
- All rights reserved
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- TEGL Systems Corporation
- Suite 780, 789 West Pender Street
- Vancouver, British Columbia
- Canada V6C 1H2
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- TEGL Windows Toolkit II
-
- LICENSE AGREEMENT
-
- TEGL software products are protected under both Canada copyright
- law and international treaty provisions.
-
- You have the non-exclusive right to use the enclosed software under the
- following terms and conditions.
-
- You may use this software on a single machine, for both personal and
- business use; and may make copies of the software solely for backup
- purposes. Other than this you agree to use this software "like a book",
- meaning the software may be used by any number of people and may be moved
- from one computer to another so long as there is no possibility of it being
- used by more than one person at one time.
-
- Programs that you write and compile using the TEGL Windows Toolkit may be
- used, given away, or sold without additional license or fees as long as
- all copies of such programs bear a copyright notice. By "copyright notice"
- we mean either your own copyright notice or if you prefer, the following
- statement, "Created using TEGL Windows Toolkit, copyright (C) 1989, 1990,
- TEGL Systems Corporation. All rights reserved".
-
- Included on the TEGL Windows Toolkit diskettes are a number of support
- files that contain encoded hardware and font information used by the
- standard graphic unit. These files are proprietary to TEGL. You may use
- these files with the programs you create with the TEGL Windows Toolkit for
- your own personal or business use. To the extent the programs you write
- and compile using the TEGL Windows Toolkit make use of these support files,
- you may distribute in combination with such programs, provided you do not
- use, give away, or sell these support files separately, and all copies of
- your programs bear a copyright notice.
-
- The Complete Games Toolkit diskettes provide a demonstration on how to use
- the various features of the TEGL Windows Toolkit. They are intended for
- educational purposes only. TEGL grants you the right to edit or modify
- these game programs for your own use but you may not give away, sell,
- repackage, loan, or redistribute them as part of any program, in executable
- object or source code form. You may, however, incorporate miscellaneous
- sample program routines into your programs, as long as the resulting
- programs do no substantially duplicate all or part of a game program in
- appearance or functionality and all copies of all such programs bear a
- copyright notice.
-
- Limited Warranty:
-
- With respect to the physical diskette and physical documentation enclosed
- herein TEGL warrants same to be free of defects and materials and
- workmanship for a period of one year from the date of purchase.
-
-
-
-
-
-
-
-
- TEGL will replace defective Software or documentation upon notice within
- the warranty period of defects. Remedy for breach of this warranty shall
- be limited to replacement and shall not encompass any other damages,
- including, without limitation, loss or business profits, business
- interruption, pecuniary loss, and special incidental, consequential, or
- other similar claims. This limited warranty is void if failure of the
- Software has resulted from accident, abuse, or misapplication. Any
- replacement Software will be warranted for the remainder of the original
- warrantly period.
-
- TEGL specifically disclaims all other warranties, express, implied, or
- statutory, including but not limited to implied warranties of
- merchantability and fitness for a particular purpose with respect to the
- Software and documentation. In no event shall TEGL be liable for any loss
- of business profit or any other commercial damage including but not limited
- to special, incidental, consequential, or other damages.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Table of Contents
-
- TABLE OF CONTENTS
- SPECIAL NOTE for documentation on disk..................... 13
- Acknowledgements........................................... 14
- Chapter 1 - Introduction................................... 15
- Why Program with TEGL Windows............................ 15
- The Components of TEGL Windows Toolkit................... 16
- What's On your disks..................................... 16
- Installing TEGL on your system........................... 18
- Development System Recommendations....................... 19
- Compiling with Turbo C................................... 19
- Compiling with Quick C................................... 19
- How to use this Reference Manual......................... 19
- teglsupervisor........................................ 19
- Program Framework........................................ 20
- Frames or Windows?....................................... 21
- How to Contact TEGL Systems Corporation.................. 21
- Chapter 2 - TEGL Easy...................................... 23
- What TEGL Windows Toolkit can do......................... 23
- Event-Driven Code........................................ 23
- Attaching your Function to an Event...................... 24
- Frames................................................... 25
- Menus.................................................... 25
- A Minimum TEGL Program................................... 26
- Adding Menus (Top Down Design)........................... 27
- Adding your First Event.................................. 28
- TEGLEasy................................................. 30
- activebutton.......................................... 30
- coltox................................................ 31
- errmess............................................... 31
- fitframe.............................................. 32
- framefromicon......................................... 32
- frametext............................................. 33
- getmousey............................................. 34
- getyesno.............................................. 35
- easytegl.............................................. 36
- lastcol............................................... 36
- lastrow............................................... 37
- outframetextxy........................................ 38
- quit.................................................. 38
- quickframe............................................ 39
- restoretext........................................... 39
- rowtoy................................................ 40
- selecteasytext........................................ 40
- seteasyfont........................................... 41
- Chapter 3 - Icons.......................................... 42
- The ICON Editor.......................................... 42
- The Main Bar Menu..................................... 42
- Editing............................................... 42
- The Drawing Bar Menu.................................. 42
- ICON Constants........................................... 45
-
- Programmer's Reference Guide - 4 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- putpict............................................... 45
- ICON Assembler Functions................................. 46
- ICON Utilities........................................... 46
- ICONDEF............................................... 46
- ICONLIB............................................... 46
- ICONINC............................................... 47
- ICONASM............................................... 47
- ICONS in TEGLIcon module................................. 47
- Chapter 4 - Frames......................................... 49
- Creating, Manipulating, and Dropping Frames.............. 49
- countframes........................................... 49
- frameexist............................................ 49
- pushimage............................................. 50
- popimage.............................................. 51
- rotatestackimage...................................... 52
- rotateunderstackimage................................. 53
- dropstackimage........................................ 54
- hideimage............................................. 56
- showimage............................................. 57
- showcoordinates....................................... 58
- Preparing a Frame for Update............................. 58
- prepareforpartialupdate............................... 58
- prepareforupdate...................................... 60
- commitupdate.......................................... 61
- Moving a Frame........................................... 62
- frameselectandmove.................................... 63
- setautorotate......................................... 64
- setmoverestrictions................................... 65
- setframemobility...................................... 66
- setmoveframecallproc.................................. 67
- movestackimage........................................ 68
- moveframe............................................. 70
- Low Level Frame Functions................................ 70
- unlinkfs.............................................. 70
- linkfs................................................ 72
- linkunderfs........................................... 73
- createimagebuffer..................................... 74
- dropimagebuffer....................................... 75
- getfsimage............................................ 76
- putfsimage............................................ 76
- freeimagebuffer....................................... 77
- getpartialfrontimage.................................. 78
- getfrontimage......................................... 78
- pageinfs.............................................. 79
- lockimage............................................. 79
- pageoutfs............................................. 80
- setimagecoordinates................................... 81
- pageoutimagestack..................................... 81
- unlockimage........................................... 82
- unuseimage............................................ 82
-
- Programmer's Reference Guide - 5 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- useimage.............................................. 83
- Mouse Click Areas........................................ 84
- definemouseclickarea.................................. 84
- findmouseclickptr..................................... 85
- resetmsclickactive.................................... 87
- resetmsclickcallproc.................................. 87
- resetmouseclicks...................................... 88
- resetmsclicksense..................................... 89
- Keyboard................................................. 90
- clearkeyboardbuf...................................... 90
- clearteglkeyboardbuf.................................. 90
- defineglobalkeyclickarea.............................. 91
- definelocalkeyclickarea............................... 92
- dropkeyclick.......................................... 92
- findkeyclickptr....................................... 93
- resetkeyclickcallproc................................. 93
- Chapter 5 - Menus.......................................... 94
- Creating a Menu.......................................... 94
- Creating a entry text list............................... 94
- createoptionmenu...................................... 96
- defineoptions......................................... 97
- createshadowom........................................ 98
- resizeoptionmenu...................................... 99
- togglecheckmark.......................................100
- toggleentrystatus.....................................101
- replaceoptiontext.....................................102
- toggleoptionbar.......................................103
- setoptionmenucolors...................................103
- setoptionmenubordercolor..............................104
- sethidesubmenu........................................104
- Creating a Bar Menu......................................105
- createbarmenu.........................................105
- outbaroption..........................................106
- setbartextcolor.......................................107
- setbarmenucolor.......................................107
- setbarbordercolor.....................................108
- setbarborderoff.......................................108
- setbarshadowtext......................................108
- setbarfillstyle.......................................109
- setbarmenumargin......................................109
- Icon Option Menus........................................110
- defineoptionclickarea.................................110
- resetoptionmenuevents.................................111
- Chapter 6 - Mouse, Keyboard and Timer Handlers.............113
- Interrupts...............................................113
- swapteglintroff.......................................113
- swapteglintron........................................114
- Mouse Emulation..........................................114
- mcursoroff............................................114
- mcursoron.............................................115
-
- Programmer's Reference Guide - 6 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- msetpos...............................................115
- Standard Mouse Functions.................................116
- showmouse.............................................116
- hidemouse.............................................116
- setmouseposition......................................116
- cursorshape...........................................117
- setmousehotspot.......................................119
- setmousecolor.........................................119
- mouseposition.........................................119
- getbuttonreleaseinfo..................................120
- getbuttonpressinfo....................................121
- clearbuttoninfo.......................................121
- setmouseminmax........................................122
- frozenmouse...........................................122
- freezemouse...........................................123
- unfreezemouse.........................................124
- setmousesensitivity...................................124
- getmousesensitivity...................................125
- setkeyboardmouse......................................125
- setkbsteps............................................126
- getkbsteps............................................127
- Timer Functions..........................................127
- swaptimerout..........................................127
- swaptimerin...........................................128
- settimerstart.........................................128
- resettimerflag........................................129
- droptimercount........................................129
- timerswtich...........................................129
- Keyboard Interrupt Events................................130
- Keyboard Scan Codes......................................130
- addcapturekey.........................................131
- deletecapturekey......................................132
- teglreadkey...........................................132
- teglkeypressed........................................133
- nilkeycallproc........................................133
- Keyboard Miscellaneous...................................133
- setshiftkeys..........................................134
- Show Button Status.......................................134
- showbuttonstatus......................................134
- Chapter 7 - Assembly Language Graphics.....................136
- Setting Video Modes......................................136
- cga640x200x2..........................................136
- ega640x350x16.........................................137
- herc720x348x2.........................................137
- setvideochoices.......................................138
- svga800x600x16........................................138
- vga640x480x16.........................................138
- videoautodetect.......................................139
- videoid...............................................139
- Graphic Primitives.......................................140
-
- Programmer's Reference Guide - 7 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- fastline..............................................140
- putpixs...............................................141
- getpixs...............................................141
- getbiti...............................................142
- putbiti...............................................142
- bigimagesize..........................................143
- setapage..............................................143
- setvpage..............................................144
- flipapage.............................................144
- flipvpage.............................................145
- videopage.............................................145
- New Graphic Primitives...................................146
- extractpixs...........................................146
- extractimg............................................146
- overlayimg............................................147
- swapbytes.............................................147
- Graphic Derivatives......................................147
- xorcornerbox..........................................148
- xorbox................................................148
- Icon Graphics............................................148
- putpict...............................................149
- pictsize..............................................149
- abort_msg.............................................149
- Chapter 8 - Special Effects................................151
- Screen Backdrop..........................................151
- clearteglscreen.......................................151
- setteglbordershow.....................................152
- setteglbackcolor......................................152
- setteglbordercolor....................................153
- setteglfillpattern procedure..........................154
- setteglfillstyle......................................154
- Creating Shadow Boxes....................................155
- shadowbox.............................................155
- shadowboxtext.........................................156
- setshadowcolor........................................156
- setshadowbordercolor..................................157
- setshadowfillpattern..................................157
- setshadowfillstyle....................................158
- Creating Shadow Text.....................................159
- shadowtext............................................159
- setshadowtexttype.....................................160
- setshadowtextshadow...................................160
- setshadowtexthighlight................................161
- shadowtexthighlightoff................................161
- Other text effects.......................................162
- extendtextxy..........................................162
- shifttextxy...........................................162
- Buttons..................................................163
- definebuttonclick.....................................163
- definelongbuttonclick.................................164
-
- Programmer's Reference Guide - 8 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- defineuserbuttonclick.................................164
- putuserbuttonclick....................................165
- Explosions...............................................165
- collapsetoiconshow....................................165
- collapsetomsclick.....................................166
- explodefromiconhide...................................166
- explodefrommsclick....................................167
- Moving and Transforming XOR Boxes........................167
- movebox...............................................167
- ziptobox..............................................168
- zipfrombox............................................169
- Icon Button..............................................170
- drawlongbutton........................................170
- Chapter 9 - Writing Events.................................171
- Mouse Awareness..........................................171
- findframe.............................................171
- checkmouseclickpos....................................172
- checkformouseselect...................................173
- Special Effects..........................................174
- pressbutton...........................................174
- visualbuttonpress.....................................175
- Chapter 10 - Animation.....................................177
- Animation Overview.......................................177
- Animation Functions......................................180
- origin procedure......................................180
- getorigin.............................................180
- destination...........................................181
- resetframe............................................182
- sequence..............................................182
- resetsequence.........................................183
- addframe..............................................184
- currentframenumber....................................185
- animateinit...........................................185
- animate...............................................186
- animatecomplete.......................................186
- Example Animation........................................186
- Chapter 11 - Writing Text..................................188
- TEGLWrt Variables........................................188
- Bit-mapped Fonts.........................................188
- Creating Your Own Bit-mapped Fonts.......................188
- TEGLWrt Functions and Procedures.........................189
- fmttegltextxy.........................................189
- outtegltextxy.........................................189
- tegltextwidth.........................................190
- teglcharwidth.........................................191
- teglcharheight........................................191
- teglwrtchar...........................................191
- setproportional.......................................192
- setteglfont...........................................192
- Showing ALL Fonts FONTTEST.PAS...........................192
-
- Programmer's Reference Guide - 9 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- fontname..............................................193
- showonefont...........................................193
- showfonts.............................................193
- Chapter 12 - Event Library.................................195
- The File Selector........................................195
- selectafile...........................................195
- String Editing Dialog....................................196
- editstring............................................196
- Mouse Sensitivity Dialogue Window........................196
- setmousesense.........................................197
- Bells & Whistles, Sound Unit.............................197
- asksoundsense.........................................197
- beep..................................................198
- slidebeep.............................................198
- soundswitch...........................................199
- Chapter 13 - Virtual Memory Manager........................200
- Heap Management..........................................200
- The Heap Manager.........................................200
- The TEGL Heap Error Function.............................201
- The TEGL Heap Manager Functions..........................202
- cgetmem...............................................202
- cfreemem..............................................203
- Expanded Memory Manager (EMM)............................203
- Expanded Memory Functions................................204
- emminstalled..........................................204
- emspagesavailable.....................................205
- allocateexpandedmemorypages...........................205
- mapexpandedmemorypages................................206
- getpageframebaseaddress...............................206
- deallocateexpandedmemorypages.........................207
- getversionnumber......................................207
- gethandlecountused....................................208
- getpagesownedbyhandle.................................209
- Expanded Memory Test Program.............................209
- A RAM Disk Driver........................................212
- emsopen...............................................213
- emsseek...............................................214
- emsblockwrite.........................................214
- emsblockread..........................................215
- emsclose..............................................216
- Virtual Disk Heap........................................216
- vdskopenheapfile......................................217
- vemsopenheapfile......................................218
- vdskgetmem............................................219
- vdskfreemem...........................................219
- vdskwriteheapdata.....................................220
- vdskreadheapdata......................................221
- vdskcloseheapfile.....................................221
- The Virtual Heap Error Function..........................222
- The Virtual Memory Manager...............................222
-
- Programmer's Reference Guide - 10 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- useharddisk...........................................223
- MoveFromVirtual procedure.............................223
- movetovirtual.........................................224
- freevirtual...........................................224
- cmaxavail.............................................225
- virtualmemused........................................225
- The Virtual Memory Error Function........................225
- Resolving Fragments......................................226
- reservehugeminimum....................................227
- Chapter 14 - Sizing and Sliders............................228
- defineresizeclickarea.................................228
- defineresizeminmax....................................229
- definesliderarea......................................229
- dropsliders...........................................230
- findsliderfs..........................................230
- resizeframe...........................................231
- selectandmoveframe....................................232
- setslideposition......................................232
- Miscellaneous Functions....................................233
- checkctrlbreak........................................233
- checkctrlbreakfs......................................233
- droptimertick.........................................234
- nilunitproc...........................................234
- overlaparea...........................................235
- settimertick..........................................235
- Graphics Library - tgraph..................................237
- Bar...................................................237
- closegraph............................................238
- detectgraph...........................................238
- getbkcolor............................................238
- getcolor..............................................239
- getfillpattern........................................239
- getgraphmode..........................................240
- getmaxx...............................................240
- getmaxy...............................................240
- gettextsettings.......................................241
- graphresult...........................................241
- imagesize.............................................241
- initgraph.............................................242
- line..................................................242
- outtextxy.............................................243
- rectangle.............................................243
- restorecrtmode........................................243
- setbkcolor............................................244
- setcolor..............................................244
- setfillpattern........................................244
- setfillstyle..........................................245
- settextjustify........................................245
- APPENDICES.................................................246
- Video Buffers............................................246
-
- Programmer's Reference Guide - 11 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- Windows..................................................246
- Frames...................................................246
- A Frame Stack............................................247
- A Simple Window Manager..................................247
- Partial Image Update.....................................249
- Refined Partial Image Update.............................249
- A Refined Partial Image Update Algorithm.................250
- A Quick Run through the algorithm........................252
- TEGL Heap Manager........................................254
- TEGL Upper Heap Manager..................................258
- Combining the best of both Heap Managers (Coexisting)....260
- Conditional Compilation..................................263
- INDEX......................................................264
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Programmer's Reference Guide - 12 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- SPECIAL NOTE for documentation on disk
-
- You have received Version II of the TEGL Windows Toolkit for TURBO C. The
- documentation that you are reading is supplied on disk. We will have a
- printed manual in the near future and it will be somewhat different that
- what you are looking at now.
-
- Because we wanted everyone to be able to read this manual and be able to
- print it out we have not embedded any special control characters in it
- with the exception of formfeeds at page breaks.
-
- In this manual you will notice that at times there are references to
- things like ctrlkey or keydown or something discriptive but somewhat odd.
- Please, be imaginative, these will be icons when the manual is printed.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Programmer's Reference Guide - 13 - TEGL Windows Toolkit
-
-
-
-
-
- Acknowledgements
-
- Acknowledgements
- ___________________________________________________________________________
-
- In this manual references are made to several products
-
-
- TURBO C and TURBO Assembler are registered trademarks of
- Borland International.
-
- IBM is a registered trademarks of International Business
- Machines Inc.
-
- MS-DOS and Windows are registered trademarks of Microsoft
- Inc.
-
- MacIntosh is a registered trademark of Apple Computer Inc.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Programmer's Reference Guide - 14 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 1 - Introduction
-
-
- INTRODUCTION
- ___________________________________________________________________________
-
- Welcome to the world of GUI (Graphical User Interface) in a DOS
- environment. This guide will provide you with the basics (and more) for
- getting started with using the TEGL Windows Toolkit.
-
- TEGL Windows is a comprehensive GUI toolkit for the simplest to the most
- sophisticated system programming projects. In order to exploit all the
- advantages of this toolkit, we encourage you to experiment and to try the
- examples as listed in this manual. Spending time learning the functions of
- TEGL Windows will reward you many times over with a system that
- provides a Professional look and feel. The power of TEGL Windows
- is limited only by your imagination.
-
- Why Program with TEGL Windows
-
- Because TEGL Windows Toolkit provides the framework in making programs
- easy to use. In this way, it is similar to several other user interfaces
- on the market today, including Apple's Macintosh, Microsoft's Windows and
- GEM from Digital Research Incorporated.
-
- Programs made with TEGL Windows are easier to use for several reasons,
- visual effects of graphics can generally communicate information more
- effectively than text. For example, the graphical image of a folder
- suggests that it contains documents, drawings, and even other folders.
-
- Provided are powerful functions that you can use to build very interactive
- applications. By q very interactive, we mean a type of user interface
- where a significant portion of the design and development effort goes into
- making the program easy to use.
-
- TEGL Windows Toolkit is based on event handling. Events consists of
- anything from a key getting pressed on the keyboard, to a timer signaling
- that some amount of time has elapsed, to a message indicating that the
- user has selected a particular item from the menu or has selected an icon.
- A particularly useful capability of this is that while the TEGLSupervisor
- is waiting for one of these events to occur, you can set the timer to
- signal a background task like an internal print spooler. This limited
- multitasking capability makes it easier to build very interactive
- programs.
-
- It's important to note that the TEGL Windows Toolkit supports only a
- single application running at any given time. Microsoft's Windows will
- support multiple concurrent applications, provided they are q
- well-behaved, which means that they don't directly manipulate the
- computer's hardware. Most popular applications, by the way, are not
- well-behaved.
-
-
- Programmer's Reference Guide - 15 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 1 - Introduction
-
- TEGL is for a single application, which has the beneficial effect of being
- part of the final application code and, on the average, much faster than
- programs written for Windows or GEM. TEGL also takes less RAM, requiring
- only 50k when all features are used.
-
- The Components of TEGL Windows Toolkit
-
- Now that you have a rough idea of what the TEGL Windows Toolkit is and how
- it relates to other alternatives in the microcomputer software marketplace,
- let's explore its' components n more detail. The purpose of this section
- is to give you an overall understanding of how to use the toolkit in your
- program.
-
- TEGL is subdivided into a set of libraries; multitasking kernel; windowing
- screen manager; mouse, keyboard and timer handler; a virtual heap manager;
- drop down and pop-up menu events; and an animation unit.
-
- One of the original goals of TEGL was to provide a graphical user
- interface (GUI) to a computer running under DOS. This interface is used in
- a number of entertainment products produced by TEGL Systems Corporation
- (TSC). As TSC designed and built the entertainment products, TEGL was
- created to build a set of software routines that were needed by the games.
- TSC gathered these routines into modules, each categorized by their
- overall function. For instance, all the routines that manipulate windows
- are collected and form the TEGLUnit. Similarly, all the drop-down menus
- and menu bars form TEGLMenu.
-
- TEGL Windows Toolkit is the tools that were developed in writing these
- first entertainment applications. These tools are now available for
- developing any application
-
- The modules are categorized by the kind of functions they deliver;
- TEGLintr handles the mouse, keyboard and timer interrupts; TEGLMenu
- provides drop down menus and menu bars; Animate provides icon animation;
- and VIRTMem provides the virtual heap for almost unlimited windowing
- ability.
-
- TEGLUnit provides a high level integration between window frames,
- mouse click areas, keyboard handler, timer interrupts, virtual memory, and
- multitasking kernel.
-
- What's On your disks
-
- For your reference, here's a summary of most of the files on the
- distribution disks:
-
-
- README.TXT
- This file contains any last-minute notes and
- corrections, type README at the system prompt to
-
- Programmer's Reference Guide - 16 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 1 - Introduction
-
- view the file. You may print this file on your printer
- for future reference, once you review the material.
-
- TEGLSYS.H, TEGLSYS.LIB
- The header file and library for the toolkit. This is all
- you need to start programming.
-
- TEGLUNIT.C
- This is the window manager that provides the graphical
- interface support for the other modules. This module
- provides the event supervisor and the frame/stack
- coordinator.
-
- TEGLMENU.C
- This unit provides the drop down menu interface.
-
- TEGLGRPH.C
- Module that provides shadow boxes, shadow texts,
- exploding and imploding boxes, pop-down/pop-up icon
- buttons, etc..
-
- TEGLICON.C
- A library of standard icons; key OK, key CANCEL,
- key NEXT, key LAST.
-
- TEGLINTR.C MOUSEASM.ASM
- Integration of keyboard and mouse handler. This unit
- provides the standard mouse routines which integrates
- the keyboard cursor keys and the mouse to provide a
- seamless dual control of the mouse cursor; with or
- without a mouse driver.
-
- FASTGRPH.C EGAGRAPH.ASM
- Fast assembly language graphics routines. This is the
- core of the graphical routines that provide the
- foundation for pop-down menus and movable windows.
- This module includes functions that interface with the
- ANIMATE unit, to allow the recognition of video paging.
-
- TEGLWRT.C WRTASM.ASM
- Crisp proportional Bit-Mapped screen fonts, ranging
- from 6 to 24 pixels in height.
-
- VIRTMEM.C FREEOPEN.ASM
- Virtual Memory handler that interfaces with TEGLUNIT.
- This unit automatically pages out images from memory to
- EMS, hard disk, or floppy (depending on availability),
- when memory is at a premium.
-
- SELECTFL.C
-
- Programmer's Reference Guide - 17 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 1 - Introduction
-
- A standard event unit that may be used by any
- application program to provide a dialogue window in
- selecting filenames from a list of file on disk.
-
- SENSEMS.C
- A standard event unit that provides a dialogue window
- that allows a user to adjust the sensitivity of a
- mouse.
-
- SOUNDUNT.C
- A standard event unit that allows a user to adjust the
- duration and the sound output of a tone.
-
- ANIMATE.C
- Unit that allows icons to be animated.
- TEGL.C, TEGL.PRJ
- A demonstration program that uses most of the features
- of the TEGL Windows Toolkit II.
-
- FONTTEST.C
- A demonstration event unit that displays all available
- fonts in movable windows. Used in tegl.pas (sample
- program).
- DEBUGUNT.C
- A demonstration event unit that displays general
- information regarding windows and the number of times
- the mouse button has been pressed.
- FONTASM.ZIP
- A library of bitmapped fonts in Turbo Assembler format.
- The source may be modified to create a new font.
- ICONEDIT.C, ICON*.*
- The Icon Editor, written using the TEGL Window Toolkit,
- to design and generate icons to include in your TEGL
- application. ICONASM, ICONDEF, ICONINC and ICONLIB are
- standalone programs that will assist you in generating
- various formats that you can use to add icons to your
- program. A number of standard icons have been created to
- include immediately into your application.
- SAM*.C, SAM*.PRJ
- Some of the sample programs in this guide are provided
- in ready-to-compile form.
-
- MAKEFILE.MAK
- The make file for compiling the library.
-
-
- Installing TEGL on your system
- The complete TEGL Toolkit is approximately 3 megabytes of source code,
- when expanded. A hard disk is required for the installation. It may be
- possible to compile on floppy, but we haven't tried it.
-
- Programmer's Reference Guide - 18 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 1 - Introduction
-
-
- At the DOS prompt, type INSTALL, and follow the instructions.
-
- Development System Recommendations
- You must have 640k RAM, a hard disk drive, and an EGA/VGA graphics card
- with 256k memory and EGA/VGA color monitor on an IBM PC or compatible
- computer. In our development, we've used an IBM PC AT with 2.5MB RAM, 72MB
- hard disk, and a paradise VGA 256k card with a NEC/MultiSync 3D. We've
- also tested all our examples on an IBM PC XT with 640k RAM, a 20MB hard
- disk, and a ATI VIP VGA graphics adapter card with an IBM 8513 VGA color
- monitor.
-
- Compiling with Turbo C
-
- TEGL Windows Toolkit requires Borland's Turbo C Version 2.0, and Turbo
- Assembler to compile all the units. Turbo Assembler is only needed if you
- make the library (which is not necessary). Only Turbo C is required to
- compile programs.
-
- Refer to the Turbo C Reference Manual for including headers and using
- libraries within programs, as well as setting up the environment and
- creating project files.
-
-
- Compiling with Quick C
-
- TEGL Windows Toolkit requires Microsoft Quick C Version 2.0. The graphics
- functions provided in graphics.lib can be used. See the Appendix
- Conditional Compilation to best determine your requirements.
-
- How to use this Reference Manual
-
- This manual is organized in a presentation manner to lead you through the
- concepts of the TEGL Windows Toolkit II.
-
- Each Function is shown seperately with its name, parameter list, and other
- references. All functions are prototyped in "teglsys.h". For a start here
- is the main entry point into the TEGL Windows Toolkit II.
-
-
- ___________________________________________________________________________
-
- teglsupervisor
- ___________________________________________________________________________
-
-
-
- Function
- Main entry point.
- Syntax
-
- Programmer's Reference Guide - 19 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 1 - Introduction
-
- void teglsupervisor(void);
- Remarks
- This should be the last statement in main.
- Example
-
-
- void main()
- {
- /* all the setup code for menus etc. goes first */
-
- teglsupervisor();
- }
-
-
-
-
- Program Framework
-
- Most of the examples presented throughout this manual will require the
- following minimal skeletal C framework before the example code will
- compile and execute. A few of the examples given are complete programs.
-
-
-
-
-
- /* samshell.c */
- /* the minimum requirements for a program */
- /* using TEGL Windows Toolkit II */
-
- #include <graphics.h>
- #include "teglsys.h"
-
- void main()
- {
- easytegl();
-
- /* insert your code here */
-
-
-
- /* then turn control over to the supervisor */
- /* use cntrl-break to exit a program that */
- /* doesn't have a specific break out point. */
-
- teglsupervisor();
- }
-
-
-
-
- Programmer's Reference Guide - 20 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 1 - Introduction
-
-
- Once control has been turned over to the supervisor then the only way to
- exit a program is by a menu selection or icon that halts the program. Many
- of the example programs don't have this so you must press Ctrl-Break to
- exit. When Ctrl-Break is pressed then program control is turned over to
- an Event Handler. In the case of the sample programs control is passed to
- quit in tegleasy.
-
- An Event Handler, as covered in Chapter 4, is usually attached to an icon,
- menu selection, or in this case the Ctrl-Break handler. The Ctrl-Break
- handler, when attached to an exit event, allows the program to exit
- gracefully by pressing ctrlkey scrlock which is the break key on
- most keyboards.
-
- Chapter 2 provides a foundation to using the TEGL Windows Toolkit by using
- a few program examples. Chapter 3 shows you how to create an icon using
- the icon editor, and how to integrate and use the icons in your program.
- Chapter 4 is heart of the windowing system, which uses most of the
- functions provided by the other modules. In Chapter 5 we delve further
- into how the teglmenu works along with teglunit to provide the
- standard drop-down menus and exploding windows. In Chapters 6 through 8,
- we discuss some of the graphic and mouse primitives that the teglunit
- uses. You may use some of these routines independently of TEGL Windows
- Toolkit. In Chapter 10 we explore animate along with a sample
- application that animates a button icon. Chapter 11 looks at writing text
- to a window using bit-mapped fonts. Chapter 12 provides an overview of the
- standard event library like selecting a file and setting the mouse
- sensitivity. In Chapter 13, we look at the Virtual Memory handler and how
- to use VM within an application. Finally, in Chapter 14 and 15, we look at
- re-sizing, slider bars and anything else that we may have missed.
- Appendices provide greater details on the TEGL Windows Toolkit and the
- philosophy behind the design.
-
- Frames or Windows?
-
- In this manual the word frame is used often. A frame is our term for
- the implementation of a window. All the identifiers in the toolkit use
- frame, not window. You can use these terms interchangeably.
-
- How to Contact TEGL Systems Corporation
- If you have any comments or suggestions, you may contact us by
- writing to
-
- TEGL Systems Corporation
- 780 - 789 West Pender Street
- Vancouver, British Columbia
- Canada, V6C 1H2
-
- or phone us at
-
-
- Programmer's Reference Guide - 21 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 1 - Introduction
-
- (604) 669-2577
-
- or facsimile us at
-
- (604) 688-9530
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Programmer's Reference Guide - 22 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- TEGL Easy
- ___________________________________________________________________________
-
- The TEGL Windows Toolkit provides tools to assist you in creating an
- eye-appealing, functional and intuitive graphical interface to your
- programs.
-
- There is no fixed format that you must follow when using the TEGL Windows
- Toolkit. Screen handling, menus, or push button icons are a function of
- your program design and not a mandatory function of the TEGL Windows
- Toolkit. However, the tools are provided so you can use emulate the
- look and feel of most popular windowing packages without locking you
- into a ridged menu system.
-
- What TEGL Windows Toolkit can do
-
- Overlapping windows are handled without having the application program
- redraw the window whenever that window is uncovered. This removes the
- complexity of having to redraw, which is necessary with some windowing
- systems. The only time a window has to be redrawn is when it is re-sized.
-
- The overhead in maintaining graphic images in memory is offset by the
- virtual memory manager which automatically swaps the images to EMS and/or
- disk when more memory is needed. Even with memory swapping, application
- programs are faster and smaller than those written for other windowing
- environments.
-
- TEGL Windows handles all mouse and keyboard activities, including all
- selections of a menu items and clicks on a mouse click area. When the
- user wants to move a window for instance, the teglsupervisor handles
- all of the user interaction from the clicks of the right mouse button on a
- window to when the button is released to indicate the new position. When
- the button is released, and moveframecallproc has been installed for
- that window, the teglupervisor will call your application procedure
- with the new location. Your application can either move the frame by
- calling movestackimage or not do so, depending on whatever it
- determines is appropriate.
-
-
- Event-Driven Code
-
- While it is possible to write your application in a serial manner using
- TEGL Windows by polling the keyboard to see if a key has been pressed, or
- checking the mouse if the mouse has been clicked on an icon or menu, it is
- much more efficient to write using Event-Driven programming.
- Event-driven programming is a style of building programs that makes for
- extremely interactive applications.
-
- An event is simply the automatic calling of one of your application's
- functions that is triggered by an action such as the mouse cursor
-
- Programmer's Reference Guide - 23 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- overlapping with an icon on the screen. This type of event handling
- removes the complex checking of keyboards and mouse devices from the
- central program and allows for an almost parallel (multitasking) type of
- program to be created.
-
- Your choice in programming will determine whether your program responds to
- the user in a sequential mode where one action must be completed before
- proceeding to the next, or multiple activities that may be completed at
- the user's leisure.
-
- A good example of multiple event handling is a program that simulates a
- calculator. Each key of the calculator pad is tied together with a
- Mouse Click Area event-handler (ie. a C function) that handles that
- particular key. With the selection of one of the numeric icon keys, the
- supervisor activates the appropriate event-handler which either adds,
- multiplies, subtracts, or divides the digits. On completion of the
- event-handler's task, the control is returned back to the supervisor to
- await for other events. Other event-handlers, such as notepads, will
- continue to respond to keyboard or mouse actions along with the activities
- on the calculator.
-
- An Event is a powerful concept. Hypertext on the MacIntosh is based on a
- similar structure. By associating an event with a word, image, or icon,
- you can chain a series of events together. One event may lead to
- another?
-
- The number of icon/events that can be created is limited only by available
- memory.
-
-
- Attaching your Function to an Event
-
- There are six (6) basic types of events that the teglsupervisor
- recognizes. The following will provide a brief discussion on event
- handling.
-
-
- {bo Mouse Click Area}
-
- This event occurs whenever the mouse cursor overlaps a defined mouse click
- area on the screen. Depending on the activation sense, the supervisor may
- call the event-handler only if the left button is clicked (activation
- sense set to msclick), or if the mouse cursor passes over the defined
- mouse click area (activation sense set to mssense). The most common
- use of a mouse click area is the association of an icon with an
- event-handler.
-
- {bo Click and Drag}
-
- This event is associated with the movement of a window. Control is passed
-
- Programmer's Reference Guide - 24 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- to the Event-handler after a new frame position has been selected. One use
- of this type of event processing is the dragging of an icon-frame to the
- trash can (like the MacIntosh).
-
- {bo Expand and Shrink}
-
- This event is associated with the sizing of a window. Control is passed to
- the Event-handler after a new frame size has been selected. We use this
- type of event to re-size a window.
-
- {bo Keyboard Events}
-
- To accommodate systems without a mouse. The Keyboard Event allows you to
- tie the keyboard to any normal mouse-click-area event handler.
-
- {bo Timer Ticks}
-
- The PC has an internal timer that interrupts the activities of any running
- program 18 times a second. This interruption is transparent to the
- operating system and is used mainly to update the system clock.
-
- The TEGLunit module uses this timer to provide a flag for the interval of
- timed events. An event-handler may be defined to occur at resolutions up
- to 18 times a second or several hours later.
-
- {bo Ctrl-Break}
-
- The Ctrl-Break event is usually tied with the event-handler quit, but,
- like any Event, you may write your own to perform a a different task when
- a Ctrl-Break event occurs.
-
-
-
- Frames
-
- TEGL Windows Toolkit is a window manager or more correctly a FRAME STACK
- coordinator. A frame is any defined region of the screen. By stacking two
- or more frames on the screen, the supervisor monitors the location of the
- frames and ensures that each frame retains it's own entity.
-
- Once a frame is created, the frame area can be cleared and drawn with any
- graphic functions provided by the Turbo C language or any other
- graphical functions provided by other library packages. However, the
- responsibility of drawing within the window is with the program.
-
- Use the x, y, x1, y1 coordinates provided within the frame struct
- when drawing to the window.
-
- Menus
-
-
- Programmer's Reference Guide - 25 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- The TEGL Menus are actually event-handlers that have been written to
- accommodate drop-down menus, menu selections, lists within a frame, etc.
-
- The menus require a list of items and related events to be created. The
- list may then be attached to a bar menu using the OutBarOption, which
- is simply a frame with multiple horizontal mouse click defines.
-
- When teglsupervisor senses the mouse overlapping with one of the bar
- menu selections, an internal baroptionmenu event is called and a
- search is made to find the list that is related to the selection. A menu
- window is then created and displayed using the list. The menu window is
- simply another frame with multiple mouse click defines.
-
-
- A Minimum TEGL Program
-
- The following demo program, prints out the message q Hello World! to a
- small movable window. Note: this one doesn't require the minimum shell
- that we described in the Introduction.
-
-
-
-
- /* samc0201.c */
- /* the minimum requirements for a program */
- /* using TEGL Windows Toolkit II */
-
- #include <graphics.h>
- #include "teglsys.h"
-
- void main()
- {
- easytegl();
-
- /* insert your code here */
-
- pushimage(100,100,200,120);
- shadowbox(100,100,200,120);
- setcolor(BLACK);
- outtegltextxy(105,105,"Hello world");
-
- /* then turn control over to supervisor */
-
- teglsupervisor();
- }
-
-
-
-
-
-
- Programmer's Reference Guide - 26 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
-
-
- Adding Menus (Top Down Design)
-
- A powerful feature in programming with TEGL Windows is the ability to
- visually see your application develop. Top down design is a methodology
- where the layout and menu designs are created first and the functional
- aspect of the program created later. Program stubs are used as place
- markers to indicate the required function.
-
- Adding a drop down menu and connecting the event later is a simple
- task with TEGL Windows.
-
-
-
-
- /* samc0202.c */
-
- #include <graphics.h>
- #include "teglsys.h"
-
- optionmptr om1, om2;
-
- unsigned getmssense(imagestkptr ifs, msclickptr ms)
- {
- setmousesense(ifs->x,ifs->y);
- return(1);
- }
-
- void main()
- {
- easytegl();
-
- om1 = createoptionmenu(font14);
- defineoptions(om1," Info... ",TRUE,NULL);
- defineoptions(om1,"--", FALSE, NULL);
- defineoptions(om1," Quit ", TRUE, quit);
-
- om2 = createoptionmenu(font14);
- defineoptions(om2," Memory ",TRUE,showcoordinates);
- defineoptions(om2," Mouse sensitivity ",TRUE,getmssense);
-
- createbarmenu(0,0,getmaxx());
- outbaroption(" File ",om1);
- outbaroption(" Utility ",om2);
-
-
- teglsupervisor();
- }
-
-
- Programmer's Reference Guide - 27 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
-
-
-
- The event showcoordinates is defined as part of the DebugUnt
- module, setmousesense is defined in SENSEMS, and Quit is
- defined in TEGLEasy.
-
- Info... is defined to NULL which
- is a program event stub that does nothing.
-
- Adding events as you go along is easy, now that the menu is set up.
-
- Adding your First Event
-
- The following is an event that opens a window and writes a message.
- Notice how we attached infooption as an event to the menu selection
- Info... by replacing NULL with infooption.
-
-
-
-
-
- /* samc0203.c */
-
- #include <graphics.h>
- #include "teglsys.h"
-
- optionmptr om1, om2;
-
- unsigned infooption(imagestkptr ifs, msclickptr ms)
- {
- imagestkptr fs;
- unsigned x=200,y=120,w=340,h=100;
-
- hidemouse();
- quickframe(&fs,&x,&y,&w,&h);
-
- setcolor(BLACK);
- frametext(fs,1,2,"TEGL Windows Toolkit II");
- frametext(fs,2,2,"Copyright 1990, TEGL Systems Corporation");
- frametext(fs,3,2,"All Rights Reserved.");
- showmouse();
-
- return(1);
- }
-
- unsigned getmssense(imagestkptr ifs, msclickptr ms)
- {
- setmousesense(ifs->x,ifs->y);
- return(1);
-
- Programmer's Reference Guide - 28 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- }
-
- void main()
- {
- easytegl();
-
- om1 = createoptionmenu(font14);
- defineoptions(om1," Info... ",TRUE,infooption);
- defineoptions(om1,"--", FALSE, NULL);
- defineoptions(om1," Quit ", TRUE, quit);
-
- om2 = createoptionmenu(font14);
- defineoptions(om2," Memory ",TRUE,showcoordinates);
- defineoptions(om2," Mouse sensitivity ",TRUE,getmssense);
-
- createbarmenu(0,0,getmaxx());
- outbaroption(" File ",om1);
- outbaroption(" Utility ",om2);
-
- teglsupervisor();
- }
-
-
-
-
- You may notice that the event returns to the TEGLSupervisor leaving
- the window on the screen.
-
- We can refined this procedure by adding a while loop to wait for the user
- to click on a icon. The getmousey(ifs) function will return once the
- user has selected the OK icon.
-
- The new event listing.
-
-
-
-
- unsigned infooption(imagestkptr ifs, msclickptr ms)
- {
- imagestkptr fs;
- unsigned x=200,y=120,w=340,h=100;
-
- hidemouse();
- quickframe(&fs,&x,&y,&w,&h);
-
- setcolor(BLACK);
- frametext(fs,1,2,"TEGL Windows Toolkit II");
- frametext(fs,2,2,"Copyright 1990, TEGL Systems Corporation");
- frametext(fs,3,2,"All Rights Reserved.");
-
-
- Programmer's Reference Guide - 29 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- definebuttonclick(fs,x+300,y+70,imageOK,NULL);
-
- getmousey(fs);
-
- dropstackimage(fs);
- showmouse();
-
- return(1);
- }
-
-
-
-
- TEGLEasy
-
-
- ___________________________________________________________________________
-
- activebutton
- ___________________________________________________________________________
-
-
- Function
- Makes a button/frame.
- Syntax
- void activebutton(unsigned x, unsiged y,
- char *s, callproc );
- Remarks
- This is for creating a button which is attached to a
- frame that is the same size as the button. p the
- event can then have as the first statement
- framefromicon to make a dramatic button to frame
- transition.
- Restrictions
- if the imagestkptr is required then save the
- stackptr immediately after calling activebutton.
- See also
- explodefromiconhide, collapsetoiconshow.
- Example
-
-
- activebutton(100,100,"INFO",infooption);
-
-
-
-
-
- ___________________________________________________________________________
-
- coltox
-
- Programmer's Reference Guide - 30 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- ___________________________________________________________________________
-
-
- Function
- Calculates the X coordinate for a text col.
- Syntax
- int coltox(int col);
- Remarks
- This is used to treat the graphics display as if it
- were in text mode to make it easy to place a
- succession of characters.
- Restrictions
- The calculation is made using the currently selected
- font.
- See also
- rowtoy, setteglfont, seteasyfont.
- Example
-
-
- outtegltextxy(coltox(col)+ifs->x,rowtoy(row)+ifs->y,s);
-
-
-
-
-
- ___________________________________________________________________________
-
- errmess
- ___________________________________________________________________________
-
-
- Function
- Display an error message.
- Syntax
- void errmess(unsigned x, unsigned y,char *s);
- Remarks
- The error message s is displayed in a frame at
- coordinates x,y. The frame is sized to the message
- and is adjusted to keep within the confines of the
- screen.
-
- The frame is displayed until the 'OK' button in the
- lower right corner is clicked.
- See also
- getyesno.
- Example
-
-
- errmess(100,100,"You must enter a file name first");
-
-
- Programmer's Reference Guide - 31 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
-
-
-
-
- ___________________________________________________________________________
-
- fitframe
- ___________________________________________________________________________
-
-
- Function
- Creates coordinates that fit on the physical screen.
- Syntax
- void FitFrame(unsigned *x, unsigned *y,
- unsigned *width, unsigned *height);
- Remarks
- x,y are the desired upper left coordinates for a
- frame. width and height are the desired width
- and height in pixels for the frame. If the starting
- coordinates would cause the frame to extend beyond the
- bounds of the screen then they are decremented until the
- frame will fit. If width or height are greater
- than their corresponding getmaxx or getmaxy then
- they are set to the maximum screen size.
-
- The lower right coordinates are returned in width=x1,
- and height=y1.
- See also
- quickframe.
- Example
-
-
- unsigned x=639,y=120,w=340,h=100;
-
- fitframe(x,y,w,h); /* adjusted to x=299 */
-
-
-
-
-
- ___________________________________________________________________________
-
- framefromicon
- ___________________________________________________________________________
-
-
- Function
- Opens a frame in an event that was called from a click
- on a icon.
- Syntax
-
- Programmer's Reference Guide - 32 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- void framefromicon(imagestkptr ifs, msclickptr ms,
- unsigned x, unsigned y, unsigned x1, unsigned y1);
- Remarks
- This would be the first statement in an event that is
- attached to an icon or button created with active
- button.
-
- This procedure will hide the icon then display an
- exploding wire box from the icon location to the
- coordinates x,y,x1,y1 where a frame is opened and
- cleared. An OK button is placed in the lower right
- corner of the frame and it is attached to
- collapsetoiconshow which will close the frame when
- it is clicked on.
- See also
- activebutton, explodefromiconhide
- Example
-
-
- /* samc0205.c */
-
- #include "teglsys.h"
-
- unsigned easymessage(imagestkptr frame,msclickptr mouseclickpos)
- {
- framefromicon(frame,mouseclickpos,150,150,400,190);
- prepareforupdate(stackptr);
- frametext(stackptr,1,2,"Icon to Frame Transformation");
- commitupdate();
-
- return 1;
- }
-
- void main()
- {
- easytegl();
- activebutton(100,100,"MESSAGE",easymessage);
- teglsupervisor();
- }
-
-
-
-
-
- ___________________________________________________________________________
-
- frametext
- ___________________________________________________________________________
-
-
-
- Programmer's Reference Guide - 33 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- Function
- Writes text to a frame using row, column coordinates
- simulating text mode.
- Syntax
- void frametext(imagestkptr ifs, int row, int col,
- char *s);
- Remarks
- ifs is the frame to write to. Row and Col
- are the row and column locations relative to the frame.
- That is, row 1, col 1, is the upper left corner of the
- frame. Note the coordinates are the reverse of graphics
- coordinates where column comes first.
- Restrictions
- The text display is based upon the current font. Swithing
- fonts will cause uneven text.
- Example
-
-
- /* samc0206.c */
-
- #include "teglsys.h"
-
- void main()
- {
- imagestkptr fs;
- unsigned x=100,y=100,w=200,h=50;
-
- easytegl();
-
- quickframe(&fs,&x,&y,&w,&h);
- frametext(fs,2,2,"Hello World!");
-
- teglsupervisor();
- }
-
-
-
-
-
- ___________________________________________________________________________
-
- getmousey
- ___________________________________________________________________________
-
-
- Function
- Waits for a mouse click and returns the mouse
- click number.
- Syntax
- unsigned getmousey(imagestkptr ifs)
-
- Programmer's Reference Guide - 34 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- Remarks
- Mouse clicks numbers are numbered in the order that
- you define the mouse click areas.
-
- ifs is the frame where we are waiting for a mouse
- click to occur. The mouse click number is returned.
- Example
-
-
- definebuttonclick(fs,x+250,y+70,imageOK,NULL);
- definebuttonclick(fs,x+300,y+70,imageCANCEL,NULL);
-
- switch (getmousey(fs)) {
- case 1 : /* imageOK was clicked on */ break;
- case 2 : /* imageCANCEL was clicked on */ break;
- }
-
-
-
-
-
- ___________________________________________________________________________
-
- getyesno
- ___________________________________________________________________________
-
-
- Function
- Gets a yes or no response.
- Syntax
- char getyesno(unsigned x,unsigned y, char *s);
- Remarks
- x,y are the coordinates to display the frame. s
- is the question to ask, allowing that the only answer
- can be Yes or No. The frame has a yes and no
- button displayed in the lower right corner.
-
- This function returns a 1 if Yes is clicked and 0
- if No is clicked.
- Example
-
-
- if (getyesno(100,100,'Do you want to erase the file'))
- {
- /* erase the file */
- }
- else ; /* cancel the command */
-
-
-
-
- Programmer's Reference Guide - 35 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
-
-
- ___________________________________________________________________________
-
- easytegl
- ___________________________________________________________________________
-
-
- Function
- Does a simplified startup for the toolkit.
- Syntax
- void easytegl(void);
- Remarks
- This procedure should be called at the very start of
- your program. It sets up some default values and clears
- the screen.
-
- When you have become familiar with the start-up
- requirements of the TEGL Windows Toolkit then you can
- write your own initialization procedure.
- Example
-
-
- #include "teglsys.h"
-
- void main()
- {
- easytegl();
- teglsupervisor();
- }
-
-
-
-
-
- ___________________________________________________________________________
-
- lastcol
- ___________________________________________________________________________
-
-
- Function
- Returns the number or last column of a frame calculated
- by the number of text characters that will fit within
- a frame.
- Syntax
- int lastcol(imagestkptr ifs);
- Remarks
- The calculation is based upon the currently selected
- font.
-
- Programmer's Reference Guide - 36 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- Restrictions
- Does not allow for BGI fonts.
- See also
- lastrow, coltox, rowtoy.
- Example
-
-
- imagestkptr fs;
- unsigned x=100,y=100,w=200,h=50;
-
- lastcol(fs); /* returns the number of columns that will fit */
-
-
-
-
-
- ___________________________________________________________________________
-
- lastrow
- ___________________________________________________________________________
-
-
- Function
- Returns the number or last row of a frame calculated
- by the number of text characters rows that will fit
- within a frame.
- Syntax
- int lastrow(imagestkptr ifs);
- Remarks
- The calculation is based upon the currently selected
- font.
- Restrictions
- Does not allow for BGI fonts.
- See also
- lastcol, coltox, rowtoy.
- Example
-
-
- imagestkptr fs;
- unsigned x=100,y=100,w=200,h=50;
-
- lastrow(fs); /* returns the number of rows that will fit */
-
-
-
-
-
- ___________________________________________________________________________
-
- outframetextxy
-
- Programmer's Reference Guide - 37 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- ___________________________________________________________________________
-
-
- Function
- Writes text to frame using relative coordinates.
- Syntax
- void outframetextxy(imagestkptr ifs, unsigned x,
- unsigned y, char *s);
- Remarks
- Macro
- Uses the currently selected font. Normally,
- outtegltextxy(..) uses screencoordinates to display
- your graphic text. Thus you are required to add
- ifs->x and ifs->y to your offsets.
-
- outframetextxy expands to add the frame
- coordinates to your relative coordinates.
- Restrictions
- Does not work with BGI fonts.
- See also
- frametext.
- Example
-
-
- /* writes "message" at x=5,y=5 pixels from the upper left corner of fs */
- outframetextxy(fs,5,5,"message");
-
-
-
-
-
- ___________________________________________________________________________
-
- quit
- ___________________________________________________________________________
-
-
- Function
- Halts program.
- Syntax
- unsigned quit(imagestkptr ifs, msclickptr ms);
- Remarks
- Control break is set to this event by default in
- easytegl.
-
-
-
- setctrlbreakfs(quit);
-
-
-
- Programmer's Reference Guide - 38 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
-
-
-
- ___________________________________________________________________________
-
- quickframe
- ___________________________________________________________________________
-
-
- Function
- Pushes an image and clears the frame.
- Syntax
- void quickframe(imagestkptr *ifs, unsigned *x, unsigned *y,
- unsigned *width, unsigned *height);
- Remarks
- x,y are the desired upper left coordinates, width
- and height are the size of the frame. Coordinates
- are adjusted to fit the physical screen and are returned
- in x,y,width,height. The frame struc is also returned
- in ifs.
- See also
- fitframe.
- Example
-
-
-
- imagestkptr ifs;
- int x=100,y=100,w=200,h=150;
-
- hidemouse();
- quickframe(&ifs,&x,&y,&w,&h);
- frametext(ifs,2,2,"This is too TEGL easy!");
- showmouse();
-
-
-
-
-
- ___________________________________________________________________________
-
- restoretext
- ___________________________________________________________________________
-
-
- Function
- Restores the current font.
- Syntax
- Macro
- void restoretext(void);
- Remarks
-
- Programmer's Reference Guide - 39 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- the current font is saved when selecteasytext is
- called. selecteasytext allows you to temporary
- change to another font.
-
-
-
- ___________________________________________________________________________
-
- rowtoy
- ___________________________________________________________________________
-
-
- Function
- Calculates the Y coordinate for a text row.
- Syntax
- int rowtoy(int row);
- Remarks
- This is used to treat the graphics display as if it were
- in text mode and make it easier to place succeeding rows
- of text on the screen. Returns the pixel offset needed
- to add to frame->y to get row.
- Restrictions
- The calculation is based on the current font.
- See also
- coltox, lastcol, lastrow, frametext
-
-
-
- ___________________________________________________________________________
-
- selecteasytext
- ___________________________________________________________________________
-
-
- Function
- Changes to the font set by seteasyfont
- Syntax
- Macro
- void selecteasytext(void);
- Remarks
- The font used after this call is selected by previous
- call to seteasyfont.
- See also
- restoretext.
-
-
-
- ___________________________________________________________________________
-
- seteasyfont
-
- Programmer's Reference Guide - 40 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- ___________________________________________________________________________
-
-
- Function
- Set the font used by the TEGLEasy Unit.
- Syntax
- Macro
- void seteasyfont(fontptr p);
- Remarks
- Some of the routines in TEGLEasy write to the screen.
- This font is used by these routines.
- See also
- selecteasytext, restoretext
- Example
-
-
- seteasyfont(countdwn);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Programmer's Reference Guide - 41 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 3 - Icons
-
-
- ICONS
- ___________________________________________________________________________
-
- Icons are pictures that represent objects. This Icon image diskdrve
- represents a diskette.
-
- Icons are the mainstay of GUI's.
-
- The TEGL
- Windows Toolkit provides the tools that can create and manipulate icons up
- to a 100 x 100 pixels in size. By placing an icon within a window frame,
- they may be attached directly to an TEGL event to provide graphical menu
- selections, animated to provide visual feedback, displayed as graphic
- images like the TEGL Deck of Cards, or used to display a company logo.
-
- The ICON Editor
-
- Included in TEGL Windows Toolkit is a powerful icon editor that utilizes
- the full power of the tookit to provide you with fast, flexible and easy
- icon file editing. The source code for the icon editor is also included so
- you can expand and modify it to suit your needs.
-
- The Main Bar Menu
- Open ICONDEF File
-
- Opens an existing ICON.DEF file, or creates a new DEF file. To create a
- new DEF file, type in the name of the DEF file in the filename box and
- click on key OK.
-
- Quit
- Quits the icon editor. NOTE: The icon editor does not prompt you to save
- your files.
-
-
- Editing
- The mouse cursor changes to cross-hairs when the cursor enters the icon
- drawing area. Pressing the mouse left button will place a pixel at the
- current coordinates. Pressing the mouse right button will erase the pixel.
- You can hold the mouse left or right button, while moving the mouse to
- draw or erase a series of pixels.
-
- The drawing bar at the bottom of the drawing area has two functions. Press
- and hold the right mouse button on the drawing bar to drag the drawing
- area to a new location. Click with the left mouse button on the drawing
- bar to select from the drawing menu.
-
- The Drawing Bar Menu
-
- SAVE
-
- Programmer's Reference Guide - 42 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 3 - Icons
-
-
- Saves the file with the filename displayed on the drawing bar.
-
- SAVE AS
-
- Saves the file with a new filename.
-
- SAVE AND EXIT ICON FILE
- Saves the file with the filename displayed on the drawing bar and closes
- the editing area for the file.
-
- CREATE C CONSTANTS
- Creates a c constant file with the extension q .CON for including
- in a program.
-
- COPY IMAGE AREA
-
- Copies an area into the internal IMAGE AREA. When this option is active a
- scissors icon appears on the drawing bar. Click once with the left mouse
- button to mark the upper left corner of the area to copy. Move the mouse
- cursor to the bottom right corner of the area to copy and click again on
- the left mouse button. When the scissors disappear, the area has been
- copied to the internal IMAGE AREA.
-
- CUT IMAGE AREA
-
- Copies an area into an internal IMAGE AREA and clears the Icon area to the
- background color. When this option is active a scissors icon appears on
- the drawing bar. Click once with the left mouse button to mark the upper
- left corner of the area to cut. Move the mouse cursor to the bottom right
- corner of the area and click again on the left mouse button. When both
- the scissors disappear and the area is cleared, then the area has been
- copied to the internal IMAGE AREA.
-
- FILL IMAGE AREA
- Fills an area with the current pixel color. Bits that are already set on
- are not overwritten. When this option is active, a coffee mug icon appears
- on the drawing bar. Click once with the left mouse button to mark the
- upper left corner of the area to fill. Move the mouse cursor to the
- bottom right corner of the area and click again on the left mouse button.
- The coffee mug disappears when the area is filled with current pixel
- color.
-
- PASTE IMAGE AREA
-
- Paste the copied/cut area from the internal IMAGE AREA to the icon drawing
- area. When this option is active, a glue bottle icon appears on the
- drawing bar. Click once at the position where the image is to be pasted.
- The pasted image overwrites any pixels on the drawing area.
-
-
- Programmer's Reference Guide - 43 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 3 - Icons
-
- MERGE IMAGE AREA
-
- Merges the copied/cut area from the internal IMAGE AREA to the icon
- drawing area. When this option is active, a glue bottle icon appears on
- the drawing bar. Click once at the position where the image is to
- be merged. The merged image only writes to empty pixel areas.
-
- OVERLAY IMAGE AREA
-
- Overlays the copied/cut area from the internal IMAGE AREA to the icon
- drawing area. When this option is active, a glue bottle icon appears on
- the drawing bar. Click once at the position where the image is to
- be overlayed. The overlay image only writes to active pixels.
-
- ROTATE IMAGE AREA 45 DEGREES
-
- Rotates the internal IMAGE AREA by 45 degrees.
-
- ROTATE IMAGE AREA 90 DEGREES
-
- Rotates the internal IMAGE AREA by 90 degrees.
-
- REDUCE IMAGE AREA
-
- Shrinks the image within the internal IMAGE AREA by 50%. The algorithm
- deletes every second pixel.
-
- REVERSE IMAGE AREA
-
- Reverses the image within the internal IMAGE AREA from left to right.
-
- PIXEL COLOR
-
- Pick the current pixel color from a palette of 16 colors.
-
- BACKGROUND COLOR
-
- Pick the current background color from a palette of 16 colors.
-
- CHANGE PIXELS COLOR
-
- Change all pixels with color m to another color n. Where m
- and n are selected from a palette of 16 colors. To cancel the command
- without changing any pixel colors, select the same color for both m
- and n.
-
- ERASE COLOR PIXELS
-
- Erases all pixels with the selected pixel color. The color is selected
- from a palette of 16 colors.
-
- Programmer's Reference Guide - 44 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 3 - Icons
-
-
- EXPLODE ICON IMAGE
- Enlarges the drawing area. The largest size is a ratio of 3 to 1 (3 pixels
- representing 1 pixel).
-
- IMPLODE ICON IMAGE
- Shrinks the drawing area.
-
- CLEAR ICON IMAGE
- Clears the drawing area.
-
- RELOAD ICON FILE
- Reloads the original icon file.
-
- EXIT ICON FILE
- Finishes the editing of a icon file.
-
- You can open as many editing windows at once as you like. The internal
- IMAGE AREA is common to all the edit windows that are open. Consequently,
- whatever is in the internal IMAGE AREA can be pasted to any edit window.
- This allows for the building of icons from small pieces, or copying an
- icon to transform it to something different.
-
-
- ICON Constants
-
- Select from the Drawing Bar Menu CREATE C CONSTANTS, to generate
- constants for including in your program. If you have a large number of
- icons for generating constants, you can use the program ICONINC to
- generate all icons in a one pass.
-
-
- ___________________________________________________________________________
-
- putpict
- ___________________________________________________________________________
-
-
- Function
- Puts the defined icon to the specified screen area.
- Syntax
- void putpict(unsigned x,unsigned y,
- unsigned char *buf,unsigned n);
- Remarks
- x, y defines the upper left corner of the screen
- area for placing the icon image.
-
- buf points to the defined icon image.
-
- n defines the color change for any pixel that is
-
- Programmer's Reference Guide - 45 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 3 - Icons
-
- black within the icon.
-
-
- ICON Assembler Functions
-
- The program ICONASM provides a second method that allows you to add
- large icon images to your program (eg. the TEGL Deck of Cards).
-
- ICONASM generates a C function in assembler. Turbo Assembler is
- required to assemble the file to object code. You may then create an obj
- file that will link the icon function into your C program.
-
- To display the icon, use the icon function name (your icon name prefixed
- with Image).
-
-
-
- imageMyIcon(10,25,BLACK);
-
-
-
- Note that these functions are always far.
-
- ICON Utilities
-
- ICONDEF
-
- ICONDEF is a utility program that allows you to strip the .DEF files
- from a turbo C source file, include file or Assembler file, provided
- that the commented /*.. prefix is still a part of your constants.
-
- Be careful that the Input filename is not the same as one of the
- definition files. Using a suffix other then .DEF will ensure that the
- include file is not overwritten while extracting. However, any filenames
- that do end in .DEF should be copied to a subdirectory if you are not sure
- about the ICON definition names.
-
-
-
- Syntax: ICONDEF MYFILE.INC
-
- Where: MYFILE.INC is the include file generated by ICONINC
- or any file that embeds the include file.
-
-
-
- ICONLIB
-
- ICONLIB is for assisting the programmer in combining the definition
- files into a single library file for maintenance. Use ICONDEF to extract.
-
- Programmer's Reference Guide - 46 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 3 - Icons
-
-
-
-
- Syntax: ICONLIB *[.DEF] MYPROG.DLB
-
- Where: *[.DEF] may use any DOS wild-card specifications.
- MYPROG.DLB may be any library filename.
-
-
-
- ICONINC
- ICONINC helps the ICON Editor in generating a large number of Turbo
- C ICON constants. Multiple icon definitions may be output to a single
- include file.
-
-
-
- Syntax: ICONDEF *[.DEF] MYFILE.INC
-
- Where: *[.DEF] may use any DOS wildcards specifications.
- MYFILE.INC may be any include filename.
-
-
-
- ICONASM
-
- ICONASM is for assisting the ICON Editor in generating functions
- from icon definition files. Multiple functions may be output to a single
- asm file.
-
-
-
- Syntax: ICONASM *[.DEF] MYPROG.ASM
-
- Where: *[.DEF] may use any DOS wildcards specifications.
- MYPROG.ASM may be any assembler filename.
-
-
-
- ICONS in TEGLIcon module.
-
- There are a number of icons that have been created. The following
- are included in the "teglsys.h" file.
-
-
- ImageCREDITS
- TEGL Windows Toolkit II
- ImageTRASH
- A trash can
- ImageOK
-
- Programmer's Reference Guide - 47 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 3 - Icons
-
- OK button
- ImageCANCEL
- Cancel button
- ImageBLANKBUT
- A blank button for creating your own
- ImageLBUT ImageMBUT ImageRBUT
- Used by DrawLongButon to create an extra long button
- icon.
- ImageDOWN
- Down arrow.
- ImageUP
- Up arrow.
- ImageRIGHT
- Right arrow.
- ImageLEFT
- Left arrow.
- ImageR
- Registered Trademark. reg
- ImageC
- Copyright. copyright
- ImageTIGER
- A TEGL tiger.
- ImageLAST
- Last button.
- ImageNEXT
- Next button.
- ImageQUESTION
- Question Button.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Programmer's Reference Guide - 48 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- Frames
- ___________________________________________________________________________
-
- The power and speed of TEGL Windows is most apparent when handling frames.
- By automatically saving and restoring overlapping images, TEGL Windows is
- a very powerful tool for creating the illusion of separate multiple
- windows. Appendix A describes the philosophy behind the TEGL Windows
- Toolkit.
-
- This chapter provides the basic foundation for creating, manipulating, and
- attaching related items to a frame.
-
- Creating, Manipulating, and Dropping Frames
-
-
- ___________________________________________________________________________
-
- countframes
- ___________________________________________________________________________
-
-
-
- Function
- Returns the number of frames currently on the
- stack.
- Syntax
- unsigned countframes(void);
-
-
-
-
- ___________________________________________________________________________
-
- frameexist
- ___________________________________________________________________________
-
-
-
- Function
- Determines if a frame is on the frame stack.
- Syntax
- char frameexist(imagestkptr ifs);
- Remarks
- If ifs exists then it contains the address
- of one of the frames on the stack.
- Example
-
-
- if frameexist(ifs)
- dropstackimage(ifs);
-
- Programmer's Reference Guide - 49 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- pushimage
- ___________________________________________________________________________
-
-
-
- Function
- Used to save the background image before clearing and
- drawing new images in this area. Equivalent to opening
- a window area.
-
- Syntax
- void pushimage(unsigned x, unsigned y,unsigned x1,
- unsigned y1);
- Remarks
- Windows are created by pushing and popping the
- background image. x, y, x1, y1 are absolute
- coordinates starting with 0,0 at the upper left corner
- of the screen to getmaxx, getmaxy at the lower right
- corner.
- Restrictions
- Saving large images can require a lot of memory even
- with the Virtual Memory Manager. If a program is
- expected to use most of memory it would be sensible to
- include specific checks on memory requirements and
- availability before performing a PushImage.
-
- A full screen in EGA mode (640 x 350) requires about
- 110K of memory, in VGA mode (640 x 480) the requiment
- is about 150K.
- See also
- popimage, dropstackimage, rotatestackimage,
- rotateunderstackimage
- Example
- The following will create a shadowed box on the upper
- left screen area. Use the right mouse button to drag
- the box around.
-
-
-
- /* samc0401.c */
-
- #include "teglsys.h"
-
- Programmer's Reference Guide - 50 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
- void main()
- {
- easytegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
-
- teglsupervisor();
- }
-
-
-
-
-
-
- ___________________________________________________________________________
-
- popimage
- ___________________________________________________________________________
-
-
- Function
- Used to restore the top background image after a
- PushImage. Equivalent to closing a window area.
- Syntax
- void popimage(void);
- Remarks
- Restores the uppermost image area created by (it pushImage.
-
- See also
- pushimage, dropstackimage, rotatestackimage,
- rotateunderstackimage
- Example
- This example waits until a mouse button is pressed then
- calls popimage to restore the background image.
-
-
-
- /* samc0402.c */
-
- #include "teglsys.h"
-
- void main()
- {
- easytegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
- showmouse();
-
- Programmer's Reference Guide - 51 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
- while( mouse_buttons == 0 );
- popimage();
-
- while( mouse_buttons == 0 );
- abort_msg("");
-
- }
-
-
-
-
-
-
- ___________________________________________________________________________
-
- rotatestackimage
- ___________________________________________________________________________
-
-
- Function
- Rotates a frame forward or backward relative to the
- frames on the screen.
- Syntax
- void rotatestackimage(imagestkptr frame1,
- imagestackptr frame2);
- Remarks
- Frames may be rotated to the foreground to allow user
- input or updates, etc.
-
- A frame may be rotated as the first frame using
- rotatestackimage.
-
- In order to access an image that is not the most recent
- pushimage you must save the global variable
- stackptr right after the pushimage. the saved
- pointer may be used to manipulate the frame.
- Restrictions
- A frame can only be rotated above a known frame. To
- rotate a frame below another frame on the stack, use
- the rotateunderstackimage routine.
- See also
- pushimage, popimage, dropstackimage
- Example
- The following example creates two overlapping frames
- and waits for a click of a mouse button before
- rotating the bottom frame to the top.
-
-
-
-
- Programmer's Reference Guide - 52 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- /* samc0403.c */
-
- #include "teglsys.h"
-
- void main()
- {
- imagestkptr fs;
-
- inittegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
- fs = stackptr;
-
- pushimage(50,50,150,150);
- shadowbox(50,50,150,150);
-
- showmouse();
-
- while( mouse_buttons == 0 );
- rotatestackimage(fs,stackptr);
-
- while( mouse_buttons == 0 );
- abort_msg("");
-
- }
-
-
-
-
-
-
- ___________________________________________________________________________
-
- rotateunderstackimage
- ___________________________________________________________________________
-
-
- Function
- Rotates a frame forward or backward relative to the
- frames on the screen. Rotates a frame below frame2.
- Syntax
- void rotateunderstackimage(imagestkptr frame1,
- imagestkptr frame2);
- Remarks
-
- In order to access an image that is not the most recent
- pushimage you must save the global variable
- stackptr right after the pushimage. the saved
- pointer may be used to manipulate the frame.
-
- Programmer's Reference Guide - 53 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- Restrictions
- A frame can only be rotated below a known frame. To
- rotate a frame above another frame on the stack, use
- the rotatestackimage.
- See also
- pushimage, popimage, dropstackimage
- Example
- The following example creates two overlapping frames
- and awaits for a click of a mouse button before
- rotating the Top frame under the second frame.
-
-
- /* samc0404.c */
-
- #include "teglsys.h"
-
- void main()
- {
- imagestkptr fs;
-
- easytegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
- fs = stackptr;
-
- pushimage(50,50,150,150);
- shadowbox(50,50,150,150);
-
- showmouse();
-
- while( mouse_buttons == 0 );
- rotateunderstackimage(stackptr,fs);
-
- while( mouse_buttons == 0 );
- abort_msg("");
-
- }
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- dropstackimage
- ___________________________________________________________________________
-
-
- Programmer's Reference Guide - 54 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
- Function
- Used to close a frame that is not necessarily the
- topmost image on the stack. Equivalent to closing a
- window area.
- Syntax
- void dropstackimage(imagestkptr frame);
- Remarks
- Restores an image area created by pushimage.
-
- In order to access an image that is not the most recent
- pushimage you must save the global variable
- stackptr right after the pushimage. The saved
- pointer may be used to manipulate the frame.
- See also
- pushimage, popimage, rotatestackimage,
- rotateunderstackimage
- Example
- The following example creates two overlapping frames
- and awaits for a click of a mouse button before
- dropping the bottom frame from the screen.
-
-
- /* samc0405.c */
-
- #include "teglsys.h"
-
- void main()
- {
- imagestkptr fs;
-
- easytegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
- fs = stackptr;
-
- pushimage(50,50,150,150);
- shadowbox(50,50,150,150);
-
- showmouse();
-
- while( mouse_buttons == 0 );
- dropstackimage(fs);
-
- while( mouse_buttons == 0 );
- abort_msg("");
-
- }
-
-
- Programmer's Reference Guide - 55 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- hideimage
- ___________________________________________________________________________
-
-
- Function
- Hides an Image Frame from the screen but retains the
- current stack position and frontal image.
- Syntax
- void hideimage(imagestkptr frame);
- Remarks
- This procedure may be used in a variety of ways.
- Blinking a frame by alternating between hideimage and
- showimage. Moving a frame from one location to another.
- See also
- showimage
- Example
- The following example blinks a frame continuously until
- a mouse button is pressed.
-
-
-
- /* samc0406.c */
-
- #include "teglsys.h"
-
- void main()
- {
- imagestkptr fs;
- unsigned i;
-
- easytegl();
-
- pushimage(1,1,50,50);
- shadowbox(1,1,50,50);
- fs = stackptr;
- showmouse();
-
- i = 20000;
-
- do
- {
- --i;
-
- Programmer's Reference Guide - 56 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- if (i == 10000)
- hideimage(fs);
- if (i == 0)
- {
- showimage(fs,fs->x,fs->y);
- i = 20000;
- }
- }
- while( mouse_buttons == 0 );
- if (i <= 10000)
- showimage(fs,fs->x,fs->y);
-
- }
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- showimage
- ___________________________________________________________________________
-
-
- Function
- Shows a Hidden Image Frame.
- Syntax
- void hideimage(imagestkptr frame)
- See also
- hideimage
- Example
- The following example moves a frame from one location
- to another when a mouse button is pressed.
-
-
- /* samc0407.c */
-
- #include "teglsys.h"
-
- void main()
- {
- imagestkptr fs;
-
- easytegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
- fs = stackptr;
-
- Programmer's Reference Guide - 57 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
- pushimage(50,50,150,150);
- shadowbox(50,50,150,150);
- showmouse();
-
- while( mouse_buttons == 0 );
-
- hideimage(fs);
- showimage(fs,fs->x+100,fs->y+100);
-
- while( mouse_buttons == 0 );
- abort_msg("");
-
- }
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- showcoordinates
- ___________________________________________________________________________
-
-
- Function
- An Event that displays the coordinates of a frame.
- Syntax
- unsigned showcoordinates(imagestkptr ifs,
- msclickptr ms);
- Remarks
- This event displays the coordinates of a frame.
-
-
- Preparing a Frame for Update
-
-
- ___________________________________________________________________________
-
- prepareforpartialupdate
- ___________________________________________________________________________
-
-
- Function
- Prepares a portion of a frame for output. Removes all
- overlapping images above the partial area that is being
- updated on the screen.
- Syntax
-
- Programmer's Reference Guide - 58 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- void prepareforpartialupdate(imagestkptr frame;
- unsigned x, unsigned y,unsigned x1, unsigned y1);
- Remarks
- x,y,x1,y1 are absolute coordinates starting with 0,0 at
- the upper left corner of the screen to getmaxx, getmaxy
- at the lower right corner.
- Restrictions
- The coordinates must be within the absolute frame
- coordinates. Use the current Frame coordinates +
- offsets to obtain the correct absolute coordinates.
-
- prepareforpartialupdate and prepareforupdate can
- be used on multiple frames (provided the update areas
- do not overlap) but must be matched by an equal number
- of calls to commitupdate.
- See also
- prepareforupdate, commitupdate
- Example
- The following example creates two overlapping frames
- and awaits for a click of a mouse button before drawing
- a circle on the bottom frame.
-
-
- /* samc0408.c */
-
- #include <graphics.h>
- #include "teglsys.h"
-
-
- void main()
- {
- imagestkptr fs;
-
- easytegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
- fs = stackptr;
-
- pushimage(50,50,150,150);
- shadowbox(50,50,150,150);
- showmouse();
-
-
- while( mouse_buttons == 0 );
-
- prepareforpartialupdate(fs,fs->x,fs->y,fs->x1,fs->y1);
- setcolor(BLUE);
- circle(fs->x+48,fs->y+45,50);
- commitupdate();
-
- Programmer's Reference Guide - 59 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
-
- while( mouse_buttons == 0 );
- abort_msg("");
-
- }
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- prepareforupdate
- ___________________________________________________________________________
-
-
- Function
- Prepares a frame for output. Removes all overlapping
- images above the frame area that is being updated on
- the screen.
- Syntax
- void prepareforupdate(imagestkptr frame);
- Remarks
- Identical to prepareforpartialupdate, except the
- current frame coordinates are passed automatically.
- Restrictions
- prepareforpartialupdate and prepareforupdate can
- be used on multiple frames (provided the update areas
- do not overlap) but must be matched by an equal number
- of calls to commitupdate.
- See also
- prepareforpartialupdate, commitupdate
- Example
- The following example creates two overlapping frames
- and awaits for a click of a mouse button before drawing
- a circle on the bottom frame.
-
-
- /* samc0409.c */
-
- #include <graphics.h>
- #include "teglsys.h"
-
-
- void main()
- {
- imagestkptr fs;
-
- Programmer's Reference Guide - 60 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
- easytegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
- fs = stackptr;
-
- pushimage(50,50,150,150);
- shadowbox(50,50,150,150);
- showmouse();
-
-
- while( mouse_buttons == 0 );
-
- prepareforupdate(fs);
- setcolor(BLUE);
- circle(fs->x+48,fs->y+45,50);
- commitupdate();
-
-
- while( mouse_buttons == 0 );
- abort_msg("");
-
- }
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- commitupdate
- ___________________________________________________________________________
-
-
- Function
- Commits update. Replaces all overlapping images above
- the frame area that was being updated on the screen.
- Syntax
- void commitupdate(void);
- Remarks
- commitupdate must be used to close the functions
- prepareforpartialupdate and prepareforupdate.
- Restrictions
- commitupdate must be called an equal number of
- times for each prepareforpartialupdate and
- prepareforupdate.
- See also
-
- Programmer's Reference Guide - 61 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- prepareforpartialupdate, prepareforupdate
- Example
- The following example creates two overlapping frames
- and awaits for a click of a mouse button before drawing
- a circle on the bottom frame.
-
-
- /* samc04010.c */
-
- #include <graphics.h>
- #include "teglsys.h"
-
-
- void main()
- {
- imagestkptr fs;
-
- easytegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
- fs = stackptr;
-
- pushimage(50,50,150,150);
- shadowbox(50,50,150,150);
- showmouse();
-
-
- while( mouse_buttons == 0 );
-
- prepareforupdate(fs);
- setcolor(BLUE);
- circle(fs->x+48,fs->y+45,50);
- commitupdate();
-
-
- while( mouse_buttons == 0 );
- abort_msg("");
-
- }
-
-
-
-
-
- Moving a Frame
-
-
- ___________________________________________________________________________
-
-
- Programmer's Reference Guide - 62 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- frameselectandmove
- ___________________________________________________________________________
-
-
- Function
- Allows a frame to be moved. This routine is normally
- called by the teglsupervisor when the right mouse
- button is held down and the mouse cursor is positioned
- over a frame.
-
- Syntax
- imagestkptr frameselectandmove(unsigned mxpos,
- unsigned mypos);
- Result type
- Returns a pointer to the frame that the mouse had
- selected and moved.
- Remarks
- The movement of the Frame is under the control of the
- user until the mouse button is released. To move a
- frame under program control, use movestackimage.
-
- Restrictions
- This function returns immediately if neither mouse
- button is held down on entry.
-
- See also
- setmoverestrictions, setframemobility,
- setmoveframecallproc, movestackimage
- Example
- The following example displays a green mouse cursor and
- calls frameselectandmove whenever the right mouse
- button is pressed. The routine exits and changes the
- mouse cursor back to white when the left mouse button
- is pressed.
-
-
- /* samc04011.c */
-
- #include <graphics.h>
- #include "teglsys.h"
-
-
- void main()
- {
- imagestkptr fs;
-
- easytegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
-
- Programmer's Reference Guide - 63 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- fs = stackptr;
-
- showmouse();
- setmousecolor(GREEN);
-
- do
- if (mouse_buttons == 1)
- fs = frameselectandmove(mouse_xcoord,mouse_ycoord);
- while( mouse_buttons != 2 );
-
- setmousecolor(WHITE);
-
- }
-
-
-
-
-
-
- ___________________________________________________________________________
-
- setautorotate
- ___________________________________________________________________________
-
-
- Function
- Sets the frame stack auto rotate function.
- Syntax
- Macro
- void setautorotate(char onoff);
- Remarks
- Auto rotate is normally set to FALSE. That is, a frame
- will not automatically rotate to the top of the stack.
- When set to TRUE any frame that is partially covered
- will be moved to the top of the stack when
- teglsupervisor detects a left mouse button click
- anywhere on the frame.
- Example
-
-
-
- /* samc04012.c */
-
- #include <graphics.h>
- #include "teglsys.h"
-
-
- void main()
- {
- imagestkptr fs;
-
- Programmer's Reference Guide - 64 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
- easytegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
- pushimage(50,50,150,150);
- shadowbox(50,50,150,150);
-
- setautorotate(TRUE);
- showmouse();
-
- teglsupervisor();
-
- }
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- setmoverestrictions
- ___________________________________________________________________________
-
-
- Function
- Sets the minimum and maximum coordinates that a frame
- may be moved.
- Syntax
- Macro
- void setmoverestrictions(imagestkptr frame;
- unsigned x, unsigned y, unsigned x1, unsigned y1);
- Remarks
- Sets the area that a frame is restricted to when
- frameselectandmove is called.
- Restrictions
- The restriction does not apply when a frame is moved
- using movestackimage.
- See also
- frameselectandmove, setframemobility,
- setmoveframecallproc, movestackimage
- Example
- The following sets the frame mobility to the upper half
- of the screen. Use the right mouse button to move the
- frame around.
-
-
- /* samc04013.c */
-
- Programmer's Reference Guide - 65 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
- #include <graphics.h>
- #include "teglsys.h"
-
-
- void main()
- {
-
- easytegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
-
- setmoverestrictions(stackptr,0,0,getmaxx(),getmaxy() / 2);
-
- teglsupervisor();
-
- }
-
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- setframemobility
- ___________________________________________________________________________
-
-
- Function
- Toggles the ability for a frame to move.
- Syntax
- Macro
- void setframemobility(imagestkptr frame, char movable);
- Remarks
- When the mobility of a frame is set to off (FALSE), the
- frame outline will move when frameselectandmove is
- called, however, the frame is not moved to the new
- location when the mouse button is released.
-
- The default frame mobility is ON (TRUE).
- Restrictions
- The mobility toggle has no effect when a frame is moved
- using movestackimage.
- See also
- frameselectandmove, setmoverestrictions,
- setmoveframecallproc, movestackimage
-
- Programmer's Reference Guide - 66 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- Example
- The following example toggles a frames mobility to off.
-
-
-
- /* samc04014.c */
-
- #include <graphics.h>
- #include "teglsys.h"
-
-
- void main()
- {
-
- easytegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
-
- setframemobility(stackptr,FALSE);
-
- teglsupervisor();
-
- }
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- setmoveframecallproc
- ___________________________________________________________________________
-
-
- Function
- An event process that is called after an frame has been
- dragged to a new screen position.
- Syntax
- Macro
- void setmoveframecallproc(imagestkptr frame, callproc p);
- Remarks
- Can be used for the trash can effect, originating with
- the MacIntosh, by which file icons are dragged to the
- trash can to be deleted from the system.
-
- the event may check the mouseclickpos struct (fields
- ms.x, ms.y, ms.x1, and ms.y1) for the new frame
-
- Programmer's Reference Guide - 67 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- location and whether they overlap the desired frame.
- Restrictions
- If you wish for the frame to move to the new location,
- the event must call movestackimage before returning.
- See also
- frameselectandmove, setmoverestrictions,
- setframemobility, movestackimage
- Example
- The following is a very simple Event Handler that
- simply closes the frame if the frame is moved.
-
-
- /* samc04015.c */
-
- #include "teglsys.h"
-
- unsigned poof(imagestkptr ifs, msclickptr ms)
- {
- hidemouse();
- dropstackimage(ifs);
- showmouse();
- return(0);
- }
-
- void main()
- {
-
- easytegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
-
- setmoveframecallproc(stackptr,poof);
-
- teglsupervisor();
-
- }
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- movestackimage
- ___________________________________________________________________________
-
-
-
- Programmer's Reference Guide - 68 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- Function
- Move a frame to a new screen location.
- Syntax
- void movestackimage(imagestkptr frame, unsigned x,
- unsigned y);
- Remarks
- Used to move a frame under Program control to a new
- screen location. x and y are absolute coordinates that
- specify the upper left corner of the frame at the new
- location.
- Restrictions
- The coordinates are not validated, so care must be
- taken to ensure that the resulting coordinates of the
- lower right corner falls within the screen area.
- See also
- frameselectandmove, setmoverestrictions,
- setframemobility, setframecallproc
- Example
- The following example moves a smaller frame under
- another larger frame to demonstrate the integrity of
- stacked images.
-
-
-
- /* samc04016.c */
-
- #include "teglsys.h"
-
-
- void main()
- {
- imagestkptr fs;
- unsigned i;
-
- easytegl();
-
- pushimage(1,1,20,20);
- shadowbox(1,1,20,20);
- fs = stackptr;
-
- pushimage(50,50,150,150);
- shadowbox(50,50,150,150);
-
- for(i=0;i<=100;i++)
- movestackimage(fs,fs->x+2,fs->y+2);
-
- while(mouse_buttons == 0);
- abort_msg("");
- }
-
-
- Programmer's Reference Guide - 69 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
-
-
-
-
- ___________________________________________________________________________
-
- moveframe
- ___________________________________________________________________________
-
-
-
- Function
- Moves an Xor wire frame from one location to
- another.
- Syntax
- moveframe(int *fx, int *fy, int *fx1, int* fy1,
- int rx, int ry, int rx1,int ry1, int color);
- Remarks
- This only moves a wire frame not the actual frame.
- The mouse button must be held down on entry or this
- function returns immediately. rx,ry,rx1,ry1 are
- the starting coordinates. fx,fy,fx1,fy1 are the
- coordinates when the mouse button is released.
- color is the wireframe color.
-
-
- Low Level Frame Functions
-
-
- ___________________________________________________________________________
-
- unlinkfs
- ___________________________________________________________________________
-
-
- Function
- Disconnects a frame from the stack.
- Syntax
- void unlinkfs(imagestkptr frame);
- Remarks
- UnLinkFS allows you to disconnect a frame from the
- Image stack to stop any further actions by the frame
- manager.
-
- This procedure is used throughout the window management
- routines. It is provided as an external routine only
- for specialized needs.
- Restrictions
- This procedure should be used in conjunction with
-
- Programmer's Reference Guide - 70 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- hideimage, showimage, createimagebuffer,
- dropimagebuffer, and linkfs.
-
- If you unlink a frame from the stack without first
- hiding the frame, the stack manager will not
- acknowledge the existence of the frame and will
- overwrite the unlinked frame area.
- See also
- linkfs, linkunderfs
- Example
- The following example hides the frame before unlinking
- and dropping the image.
-
-
- /* samc04017.c */
-
- #include "teglsys.h"
-
-
- void main()
- {
- imagestkptr fs;
-
- easytegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
- fs = stackptr;
-
- pushimage(50,50,150,150);
- shadowbox(50,50,150,150);
-
- showmouse();
- while(mouse_buttons == 0);
-
- hideimage(fs);
- unlinkfs(fs);
- dropimagebuffer(fs);
-
- while(mouse_buttons == 0);
- abort_msg("");
- }
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- Programmer's Reference Guide - 71 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
- linkfs
- ___________________________________________________________________________
-
-
- Function
- Reconnects a frame to the stack.
- Syntax
- void linkfs(imagestkptr frame1,imagestkptr frame2)
- Remarks
- linkfs reconnects frame1 with the frame stack, above
- frame2.
-
- This procedure is used throughout the window management
- routines. It is provided as an external routine only
- for specialized needs.
- Restrictions
- This procedure should be used in conjunction with
- hideimage, showimage, createimagebuffer,
- dropimagebuffer, and unlinkfs.
- See also
- unlinkfs, linkunderfs
- Example
- The following example performs the same function as
- rotatestackimage.
-
-
- /* samc04018.c */
-
- #include "teglsys.h"
-
-
- void main()
- {
- imagestkptr fs;
-
- easytegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
- fs = stackptr;
-
- pushimage(50,50,150,150);
- shadowbox(50,50,150,150);
-
- showmouse();
- while(mouse_buttons == 0);
-
- hideimage(fs);
- unlinkfs(fs);
-
- Programmer's Reference Guide - 72 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- linkfs(fs,stackptr);
- showimage(fs,fs->x,fs->y);
-
- while(mouse_buttons == 0);
- abort_msg("");
- }
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- linkunderfs
- ___________________________________________________________________________
-
-
- Function
- Reconnects a frame with the frame stack, below the
- specified frame.
- Syntax
- linkunderfs(imagestkptr frame1,imagestkptr frame2)
- Remarks
- linkunderfs reconnects frame1 below frame2.
-
- This procedure is used throughout the window management
- routines. It is provided as an external routine only
- for specialized needs.
- Restrictions
- This procedure should be used in conjunction with
- hideimage, showimage, createimagebuffer,
- dropimagebuffer, and unlinkfs.
- See also
- unlinkfs, linkfs
- Example
- The following example performs the same function as
- rotateunderstackimage.
-
-
- /* samc04019.c */
-
- #include "teglsys.h"
-
-
- void main()
- {
- imagestkptr fs1,fs2;
-
-
- Programmer's Reference Guide - 73 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- easytegl();
-
- pushimage(1,1,100,100);
- shadowbox(1,1,100,100);
- fs1 = stackptr;
-
- pushimage(50,50,150,150);
- shadowbox(50,50,150,150);
- fs2 = stackptr;
-
- showmouse();
- while(mouse_buttons == 0);
-
- hideimage(fs2);
- unlinkfs(fs2);
- linkunderfs(fs2,fs1);
- showimage(fs2,fs2->x,fs2->y);
-
- while(mouse_buttons == 0);
- abort_msg("");
- }
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- createimagebuffer
- ___________________________________________________________________________
-
-
- Function
- Allocates an Image buffer (frame) on the Heap.
- Syntax
- void createimagebuffer(imagestkptr *frame,
- unsigned x, unsigned y, unsigned x1, unsigned y1);
- Remarks
- This procedure is used throughout the window management
- routines. It is provided as an external routine only
- for specialized needs.
- Restrictions
- This procedure should be used in conjunction with
- hideimage, showimage, createimagebuffer,
- dropimagebuffer, and unlinkfs.
- See also
- dropimagebuffer
- Example
-
- Programmer's Reference Guide - 74 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- The following example performs the same function as
- pushimage.
-
-
- /* samc04020.c */
-
- #include "teglsys.h"
-
-
- void main()
- {
- imagestkptr fs;
-
- easytegl();
-
- createimagebuffer(&fs,1,1,100,100);
- linkfs(fs,stackptr);
- getbiti(1,1,100,100,fs->imagesave);
- shadowbox(1,1,100,100);
-
- showmouse();
- teglsupervisor();
- }
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- dropimagebuffer
- ___________________________________________________________________________
-
-
- Function
- Frees the memory used by the frame on the heap.
- Syntax
- void dropimagebuffer(imagestkptr frame);
- Remarks
- This procedure is used throughout the window management
- routines. It is provided as an external routine only
- for specialized needs.
- Restrictions
- This procedure should be used in conjunction with
- hideimage, showimage, createimagebuffer,
- dropimagebuffer, and unlinkfs.
- See also
- createimagebuffer
-
- Programmer's Reference Guide - 75 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- Example
- The following example performs the same function as
- popimage.
-
-
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- getfsimage
- ___________________________________________________________________________
-
-
- Function
- Retrieves the screen image within a stacked frame.
- Syntax
- void getfsimage(unsigned x, unsigned y,
- imagestkptr frame);
- Result type
- Returns a (non-stacked) frame containing the screen
- image and other related frame information.
- Remarks
- The (non-stacked) frame may be used for replication or
- it can be merged with other frames.
- See also
- putfsimage
- Example
- The following example creates a single frame and
- replicates the frame.
-
-
-
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- putfsimage
- ___________________________________________________________________________
-
-
-
- Programmer's Reference Guide - 76 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- Function
- Places the frame saved image anywhere on the screen.
- Syntax
- void putfsimage(unsigned x, unsigned y,
- imagestkptr frame, unsigned rwbits);
- Remarks
- rwbits are constants defined in "teglsys.h" which
- define how the images are placed on the screen.
-
- FGNORN
- replaces screen area with frame image
- FGAND
- AND's screen area with frame image. Toggles off screen
- areas that do no have a frame image. Creates an outline
- of the frame image.
- FGOR
- OR's screen area with frame image. Toggles on empty
- screen areas that have a frame image. Creates a solid
- frame image.
- FGXOR
- XOR's screen area with frame image.
- FGNOT
- Inverts frame image and replaces screen area with
- image.
-
- See also
- getfsimage
- Example
- The following example creates a single frame and
- replicates the frame.
-
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- freeimagebuffer
- ___________________________________________________________________________
-
-
-
- Function
- Frees up the memory allocated for a frame buffer.
- Syntax
- void freeimagebuffer(imagestkptr ifs);
- Remarks
-
- Programmer's Reference Guide - 77 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- This is generally an internal function. Do not use it
- unless you have a clear understanding of inner workings
- of the frame stack.
-
-
-
- ___________________________________________________________________________
-
- getpartialfrontimage
- ___________________________________________________________________________
-
-
-
- Function
- Gets the partial image of a frame and returns a pointer
- to a temporary buffer.
- Syntax
- imagestkptr getpartialfrontimage(imagestkptr frame,
- unsigned x, unsigned y, unsigned x1, unsigned y1);
- Remarks
- This is a safer way to get the partial image of a
- frame than using GetBiti. Overlapping frames are
- partially removed and then restored before returning.
-
-
-
-
- ___________________________________________________________________________
-
- getfrontimage
- ___________________________________________________________________________
-
-
-
- Function
- Get the image of a frame and returns a pointer to
- a temporary buffer.
- Syntax
- Macro
- imagestkptr getfrontimage(imagestkptr ifs);
- Remarks
- This is a safer way to get the image of a frame
- than using GetBiti. Overlapping frames are
- partially removed and then restored before returning.
-
-
-
- ___________________________________________________________________________
-
- pageinfs
-
- Programmer's Reference Guide - 78 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- ___________________________________________________________________________
-
-
-
- Function
- Read an image into memory.
- Syntax
- void pageinfs(imagestkptr ifs);
- Remarks
- If the image is already in memory then no action
- is taken.
- See also
- pageoutfs.
- Example
- This example checks to see if the image is in memory
- first before attempting to read it in. note that
- pageinfs check this automatically before reading in an
- image.
-
-
- if ifs->imagepageout then /* the image is not in memory */
- pageinfs(ifs);
-
-
-
-
-
- ___________________________________________________________________________
-
- lockimage
- ___________________________________________________________________________
-
-
-
- Function
- Locks an frame image into memory.
- Syntax
- Macro
- void lockimage(imagestkptr ifs);
- Remarks
- The image is read into memory if required. The lock is
- maintained until a specific call is made to
- unlockimage.
-
- Lock image can be used where it is desirable to
- replicate an image on the screen repeatedly. After it
- is locked then it can be placed on the screen with a
- call to putbiti.
- Restrictions
- This should be used with caution especially if you are
-
- Programmer's Reference Guide - 79 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- locking in a large image. You can fragment the heap and
- the Virtual Memory Manager may not be able to allocate
- a large enough memory block for subsequent image swaps.
- See also
- unlockimage, useimage, unuseimage
- Example
- If the image is less than 64k then it can be copied
- to Turbo's heap and then the image can be unlocked
- reducing the chance of a heap error.
-
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- pageoutfs
- ___________________________________________________________________________
-
-
-
- Function
- Page out a frame image.
- Syntax
- pageoutfs(imagestkptr ifs);
- Remarks
- If the image is successfully paged out to ems or disk
- then teglfreemem is called to free up the memory
- used.
- Restrictions
- If ifs is in use, or locked or already paged out
- then no action is taken.
- See also
- pageinfs.
- Example
-
-
-
- pageoutfs(ifs);
- if (ifs->imagepageout) /* success */
-
- else ; /* failure */
-
-
-
-
-
-
- Programmer's Reference Guide - 80 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- ___________________________________________________________________________
-
- setimagecoordinates
- ___________________________________________________________________________
-
-
-
- Function
- Sets the frame pointer to a new set of coordinates.
- Syntax
- Macro
- void setimagecoordinates(imagestkptr ifs,
- unsigned x, unsigned y,unsigned x1,unsigned y1);
- Remarks
- A frame's coordinates should not be changed if it is
- visible.
-
-
-
- ___________________________________________________________________________
-
- pageoutimagestack
- ___________________________________________________________________________
-
-
-
- Function
- Requests the virtual memory manager to page out
- images to make a chunk of memory available.
- Syntax
- char pageoutimagestack(unsigned long mem);
- Remarks
- mem is the amount of memory required. A large
- value for mem will result in all image buffers
- being paged out. This function returns true if the
- amount of memory requested has been freed.
- Restrictions
- Large amounts of memory are required to process image
- swapping. If you allocate too much and don't free it up
- as quickly as possible you may get a heap error.
-
- Example
-
-
- /* -- force all imagebuffers to disk */
- if (pageoutimagestack(512000)) ; /* -- ignore result */
- /* -- do whatever needs that much memory */
- supersortmemuse(256000);
- supersort();
- /* -- release it before working with windows again */
-
- Programmer's Reference Guide - 81 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- supersortfreemem();
-
-
-
-
-
-
- ___________________________________________________________________________
-
- unlockimage
- ___________________________________________________________________________
-
-
-
- Function
- Unlocks a frame image.
- Syntax
- Macro
- unlockimage(imagestkptr ifs);
- Remarks
- unlock simply sets a flag in the imagestkptr.
- After unlocking, the Virtual Memory Manager can swap
- the image to EMS or Disk as required. If the image
- wasn't locked then no action is taken.
- Restrictions
- see restrictions for lockimage.
- See also
- lockimage, useimage, unuseimage.
- Example
- see example for lockimage.
-
-
-
-
- ___________________________________________________________________________
-
- unuseimage
- ___________________________________________________________________________
-
-
-
- Function
- Flags a frame image as no longer in use.
- Syntax
- Macro
- unuseimage(var ifs : imagestkptr);
- Remarks
- This should be called as soon as possible after a
- useimage to keep as much memory free for the virtual
- memory manager.
-
- Programmer's Reference Guide - 82 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- See also
- useimage, lockimage, unlockimage.
- Example
-
-
- useimage(ifs);
- /* -- do something with it */
-
- /* -- then let the memory manager swap it out if required */
- unuseimage(ifs);
-
-
-
-
-
-
- ___________________________________________________________________________
-
- useimage
- ___________________________________________________________________________
-
-
-
- Function
- Makes an image available for use.
- Syntax
- Macro
- useimage(var ifs : imagestkptr);
- Remarks
- The frame image is read into memory if not already
- there and then flagged as being in use.
- Restrictions
- if you do prepareforupdate then the in use flag is
- set to false.
- See also
- unuseimage, lockimage, unlockimage.
- Example
-
-
- useimage(ifs);
- /* -- do something with it */
-
- /* -- then let the memory manager swap it out if required */
- unuseimage(ifs);
-
-
-
-
-
-
-
- Programmer's Reference Guide - 83 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- Mouse Click Areas
-
- Mouse click areas are those places on the screen where we sense if the
- mouse pointer has passed over or has been clicked on. Frames can have
- mouse click areas on them that are, of course, only available if the frame
- is visible and the mouse click area is uncovered.
-
- The sensitivity of the mouse click area has two levels. The most sensitive
- is MSSENSE where just having the mouse pointer pass over the area
- causes an action. The other level is MSCLICK where the mouse pointer
- must be over the mouse click area and the left mouse button has been
- pressed.
-
-
-
- ___________________________________________________________________________
-
- definemouseclickarea
- ___________________________________________________________________________
-
-
-
- Function
- Attaches an sensitive area of a frame to an event
- function.
- Syntax
- void definemouseclickarea(imagestkptr ifs, unsigned x,
- unsigned y, unsigned x1, unsigned y1,char active,
- callproc p, char sense);
- Remarks
- ifs is any imagestkptr. the x, y, x1, y1 are
- coordinates relative to a frame. This means that the
- upper left corner of a frame is considered 0,0.
-
- active is a boolean flag to indicate whether the
- Mouse Click Area is an active entry TRUE or a
- place holder FALSE in a list of mouse clicks. A
- place holder is simply a defined entry with no action
- recognized.
-
- p is the event to call when the Mouse Click Area
- is activated, either by the mouse pointer passing by
- the click areas or a mouse click occurring on an click
- area.
-
- nilunitproc may be used to define a no-event
- handler. This may be used in conjunction with the
- functions findframe and checkmouseclickpos to
- check for the respective mouse click activation.
-
-
- Programmer's Reference Guide - 84 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- nilunitproc may also be used as a temporary
- parameter. use resetmsclickcallproc to add the proper
- event handler later.
-
- sense is either MSSENSE or MSCLICK. MSSense
- activates the event handler whenever the mouse cursor
- passes over the defined mouse click areas. MSCLICK
- requires the right mouse button to be pressed while the
- mouse cursor is on the mouse click area.
- Restrictions
- The number of mouse click areas is limited only by
- memory. Overlapping click area take priority over
- underlying click areas.
-
- The coordinates of a Mouse click area must reside
- within the Frame, otherwise the click areas are not
- recognized.
- See also
- findmouseclickptr, resetmouseclicks,
- resetmsclicksense, resetmsclickcallproc,
- resetmsclickactive, checkmouseclickpos
- Example
- The following example creates a frame that attaches an
- 'OK' icon with an Event Handler called DropBoxOption
- which simply closes the frame and exits.
-
- The function CheckforMouseSelect is used to create
- the illusion of a button being pressed when clicked on.
-
-
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- findmouseclickptr
- ___________________________________________________________________________
-
-
- Function
- Searches for a Mouse Click Pointer associated with a
- Mouse Click Number.
- Syntax
- msclickptr findmouseclickptr(imagestkptr ifs,
- unsigned clicknumber);
- Result type
-
- Programmer's Reference Guide - 85 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- Returns a mouse click pointer (msclickptr), pointing to
- a Mouse Click Structure.
- Remarks
- Click Numbers are in the order that you define the
- Mouse Click areas. The first definemouseclickarea is
- known as Click Number 1, the second is Click Number 2,
- etc..
-
- In certain instances it is easier to advance through
- the mouse click areas by Click Numbers. However, most
- functions, including the calling of Events, pass the
- Mouse Click Pointer.
-
- To translate a Mouse Click Pointer back to a Click
- Number, use the Mouse Click Pointer fields ie.
- clicknumber := mouseclickpos->clicknumber where
- mouseclickpos is of type msclickptr.
- Restrictions
- findmouseclickptr returns a NULL if the clicknumber is
- not found. Compare the resulting msclickptr with NULL
- before referencing the structure.
- See also
- definemouseclickptr, resetmouseclicks,
- resetmsclicksense, resetmsclickcallproc,
- resetmsclickactive, checkmouseclickpos
- Example
- The following example defines an array of 100 Mouse
- Click Areas. You may click with the left mouse button
- on the individual tiles to produce a sound, or on the
- 'OK' to produce a series of sounds.
-
- The function findmouseclickptr is used within the
- event handler playallnotes to translate a random
- click number into a note.
-
- The function checkformouseselect is used to create
- the illusion of a button being pressed when clicked on.
-
-
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- resetmsclickactive
- ___________________________________________________________________________
-
- Programmer's Reference Guide - 86 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
-
- Function
- Resets the active flag to indicate whether a Mouse
- Click Area Entry is active or inactive.
- Syntax
- void resetmsclickactive(imagestkptr ifs,
- unsigned mouseclicknumber, char active);
- Remarks
- The mouseclicknumber is in the order that you defined
- the mouse click areas. the first definemouseclickarea
- is known as mouseclicknumber 1, the second is
- mouseclicknumber 2, etc..
-
- active is a boolean flag to indicate whether the mouse
- Click Area is an active entry (TRUE) or a place holder
- (FALSE) in a list of mouse clicks. A place holder is
- simple a defined entry with no action recognized.
- Restrictions
- if the mouseclicknumber is invalid, the flag is not
- updated.
- See also
- definemouseclickptr, resetmouseclicks,
- findmouseclickptr, resetmsclicksense,
- resetmsclickcallproc, checkmouseclickpos
- Example
- This example creates an array of 10 buttons which all
- point to the same event handler switchon. the
- active flag for a pressed button is turned off to
- prevent multiple calls to switchon, until another
- button is pressed. resetmsclickactive is used
- within switchon to toggle the button active state.
-
-
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- resetmsclickcallproc
- ___________________________________________________________________________
-
-
- Function
- Changes the Event Handler for a Mouse click to another
- Event Handler.
-
- Programmer's Reference Guide - 87 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- Syntax
- void resetmsclickcallproc(imagestkptr ifs,
- unsigned mouseclicknumber, callproc p);
- Remarks
- mouseclicknumbers are in the order that you define the
- mouse click areas. the first definemouseclickarea is
- known as mouseclicknumber 1, the second is
- mouseclicknumber 2, etc..
-
- p is the event to pass control to when the mouse
- click area is actived.
-
- nilunitproc may be used to define a no-event
- handler. This may be used in conjunction with the
- functions findframe and checkmouseclickpos to
- check for the respective mouse click activation.
-
- nilunitproc may also be used to deactivate an
- event handler.
- See also
- definemouseclickptr, resetmouseclicks,
- findmouseclickptr, resetmsclicksense,
- resetmsclickactive, checkmouseclickpos
- Example
- This example switches between two events that play a
- different series of sounds. The function
- checkformouseselect is used to create the illusion of
- a button being pressed when clicked on.
-
-
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- resetmouseclicks
- ___________________________________________________________________________
-
-
- Function
- Removes a chain of mouse click areas from a frame.
- Syntax
- void resetmouseclicks(imagestkptr frame,
- msclickptr clickptr)
- Remarks
- the clickptr parameter is the last click pointer from
-
- Programmer's Reference Guide - 88 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- where the remainder of the chain of click areas will be
- removed.
-
- A parameter of NULL removes the Mouse Click Area
- chain completely.
- Restrictions
- the clickptr should be a valid mouseclickptr. Use
- findmouseclickptr to locate a valid pointer.
-
- if clickptr is invalid, the parameter will be treated
- as NULL.
- See also
- definemouseclickptr, findmouseclickptr,
- resetmsclicksense, resetmsclickcallproc,
- resetmsclickactive, checkmouseclickpos
- Example
- The following example displays a varying number of bars
- that can be selected. The Event Handler
- showbarlist plays a sound corresponding to the bar
- selected and clears the frame and re-displays a new
- series of bars.
-
-
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- resetmsclicksense
- ___________________________________________________________________________
-
-
- Function
- resets the sense parameter associated with a mouse
- Click Area.
- Syntax
- void resetmsclicksense(imagestkptr ifs, char newsense;)
- Remarks
- newsense is either MSSENSE or MSCLICK. MSSENSE
- activates the event handler whenever the mouse cursor
- passes over the defined mouse click areas. MSCLICK
- requires the right mouse button to be pressed while the
- mouse cursor is on the mouse click area.
- Restrictions
- resetmsclicksense resets the sense type for the chain
- of all Mouse Clicks. If you have a mixture of different
-
- Programmer's Reference Guide - 89 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- senses, use a combination of findmouseclickptr and
- field settings to reset the sense.
- See also
- definemouseclickptr, resetmouseclicks,
- findmouseclickptr, resetmsclickcallproc,
- resetmsclickactive, checkmouseclickpos
- Example
- The following example requires a menu selection to
- toggle between the menu dropping down automatically or
-